0
[Java - Loan Calculator Problem] What is my mistake?
Hi. So I have been trying to solve the loan calculator problem in the java course. But I don't quite understand my mistake because the input matches the output of the test cases. I am confused. Here is my code: import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); //your code goes here System.out.println("Here is the monthly payment schedule:"); for (int i =1; i<=3; i++) { System.out.println("Month " + i); int a = amount/10; int b = amount - a; System.out.println("Payment: 10% of " + amount + " = " + a); System.out.println("Remaining amount: " + b); amount = b; } }
4 Answers
+ 2
Check your output with expected output there..!
Should be same, no more extra or less character to be there.. Only output final result without any message
+ 1
required output is one number
+ 1
Sylv1a
I said print "x"
And you printed "x" and "y"
So our result is not matching.
Result :- test failed
0
Also: are you sure integer variables fit these calculations well?