0
(Solved)HELP - Loan Calculator in Java
The code I made for the Loan Calculator question in the java course doesn't work in the last 3 test cases. Can anyone explain to me why? https://code.sololearn.com/cjtoOq0Px25o/?ref=app
2 Answers
+ 11
pay = amount/100.0*10;
Pay is 0 (truncated) when amount becomes less than 100
System.out.println(50/100*10);//returns 0
System.out.println(50/100.0*10);//returns 5
+ 3
Ărika đ» keep it as double only just change to int while printing and use math.ceil and math.round function too