TOPIC

Presentation Error (5%)

cemarchonatto asked 9 months ago

tá tudo certin, já revirei do avesso, fiz com Switch case e IF else, e nada, alguém me ajuda

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner tc = new Scanner(System.in);

int a, b;
double sum;
a = tc.nextInt();
b = tc.nextInt();
if (a == 1) {
    sum = b*4.00;
 System.out.printf("Total: R$%.2f", sum);
}else if(a == 2){
    sum = b*4.50;
 System.out.printf("Total: R$%.2f", sum);
}else if(a == 3) {
    sum = b*5.00;
 System.out.printf("Total: R$%.2f", sum);
}else if(a == 4) {
    sum = b*2.00;
 System.out.printf("Total: R$%.2f", sum);
}else if(a == 5) {
    sum = b*1.50;
 System.out.printf("Total: R$%.2f", sum);
}
}   

}

Remember not post solutions. Your post may be reviewed by our moderators.

  • MarcosVinicius00753 replied 6 months ago

    falta o bom e velho (e chato kk) "\n" no final de cada output