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; } }

25th Jun 2022, 7:23 AM
Sylv1a
Sylv1a - avatar
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
25th Jun 2022, 8:29 AM
Jayakrishna 🇮🇳
+ 1
required output is one number
25th Jun 2022, 7:38 AM
zemiak
+ 1
Sylv1a I said print "x" And you printed "x" and "y" So our result is not matching. Result :- test failed
25th Jun 2022, 1:19 PM
A͢J
A͢J - avatar
0
Also: are you sure integer variables fit these calculations well?
25th Jun 2022, 6:48 PM
Emerson Prado
Emerson Prado - avatar