TOPIC
O que está errado ?
idassis asked 6 years ago
int codigo , quant;
double total[] = {0 , 1 , 2 , 3 , 4};
Scanner sc = new Scanner(System.in);
codigo = sc.nextInt() ;
quant = sc.nextInt() ;
switch (codigo) {
case 1 :
total [0] = quant * 4 ;
System.out.printf("Total: R$ " + "%.2f %n" , total [0] );
break;
case 2 :
total [1] = quant * 4.5 ;
System.out.printf("Total: R$ " + "%.2f %n" , total [1] );
break;
case 3 :
total [2] = quant * 5 ;
System.out.printf("Total: R$ " + "%.2f %n" , total [2] );
break;
case 4 :
total [3] = quant * 2 ;
System.out.printf("Total: R$ " + "%.2f %n" , total [3] );
break;
case 5 :
total [4] = quant * 1.5 ;
System.out.printf("Total: R$ " + "%.2f %n" , total [4] );
break;
}
This topic has not been answered yet. Be the first!