0
Paint Costs Code Coach, Why does this work?[SOLVED]
In my first program the variable "total" was an "int" and it failed tests 3 and 4. On changing it to "double", for some reason it passed all of the tests. My question is why? What difference did it make on changing the data type? My both tries: https://code.sololearn.com/cQzrf8NChi8G/?ref=app https://code.sololearn.com/cVIZLukuS9Zz/?ref=app
2 Respuestas
+ 6
Dividing an integer by an integer results in an integer.
Check, this will give the desired result:
int total = 40+(paintsNo*5);
double tax = 10.0*total/100;
System.out.println(
Math.round(total+tax)
);
+ 2
Solo thank you