java loan calculator | Sololearn: Learn to code for FREE!


java loan calculator

cannot find symbol at line 0 ??? I have used amount / 10 cause that's what 10% of amount reduces to. payment = amount / 10; // 10/100 * amount => 1/10 * amount => amount/10

1/28/2021 10:10:47 PM


6 Answers

New Answer


Hi! Try with add int in the loop... for(int x=1; x<=6; x++){... /Regards Per B




After fixing the missing "int" you will notice that your result is always a bit above the expected value. This is due to rounding errors. You can take a look at this code to understand it better


import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(; int amount = scanner.nextInt(); int loan; //your code goes here for(int i=1;i<=3;i++) { loan =amount/10; amount-=loan; } System.out.println(amount); } }


Did you do as Per suggested, u forgot the int in your code, int x=1


This usually happens When you don't input Scanner class correctly When there is some other error in the program If there is no error, force the program to run, then you get output or exact error.