Taywin
Posting Virtuoso
1,727 posts since Apr 2010
Reputation Points: 229
Solved Threads: 239
Hmm... What IDE are you using? What Java version? I used Texpad using Java 6 to compile and run, it works fine... Though, the answer from the computation (table) is all wrong...
Edit: Hmm... What's wrong with JGRASP... Let me check...
Taywin
Posting Virtuoso
1,727 posts since Apr 2010
Reputation Points: 229
Solved Threads: 239
Below is the output I get... By the way, you should use "System.out.print" instead of "System.out.println" when you accept the input from a user...
/*
Loan Amount:
10000
Number of Years:
5
Annual Interest Rate:
.1
1 83.33333333333 69361.11111111111 -5961.11111111111
2 83.33333333333 69361.11111111111 -128722.22222222222
3 83.33333333333 69361.11111111111 -198083.33333333333
4 83.33333333333 69361.11111111111 -267444.44444444444
...
...
*/
Taywin
Posting Virtuoso
1,727 posts since Apr 2010
Reputation Points: 229
Solved Threads: 239
Line 70, try changing it to...
DecimalFormat df = new DecimalFormat("#.##");
Then line 72, you are supposed to pass in a double/float without any string.
System.out.println(i+"\t\t"+df.format(interest));
Taywin
Posting Virtuoso
1,727 posts since Apr 2010
Reputation Points: 229
Solved Threads: 239