• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mortgage Amortization calculator  RSS feed

 
Thomas Johnson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you have a question about this code?
 
Stefan Evans
Bartender
Posts: 1837
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nicely formatted code.
Do you have a question associated with it? Other than "It doesn't work" ?


Your first problem is probably on line 73. Compare the format strings on line 73 with that on line 74

The other thing to be wary of is your variables.
You define interesetMonth as a class variable, and interestMonth in your calAmort method. Getting rid of those 'global' variables might make it better.




 
Thomas Johnson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I do, thank you. When I run my code I'm not getting the correct output. I have searched for a fix but, I'm stuck, I can input my numbers but I'm not getting a amortization I know I'm missing something I just can't figure out what.
 
Thomas Johnson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So Mr. Evans your saying take my private double interestMonth out of my code? And I see what your saying about line 73.
 
Thomas Johnson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fix lined 73 and this was my output???

Enter amount of loan65000
Enter interest rate per year
5.2
Enter number of years
30

Amortization Schedule for Borrower
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
old Month Interest Principle New Balance


Month Balance Payment Paid Paid Balance


1 65000.000 65000.000 0.000 65000.000 0.000
 
Knute Snortum
Sheriff
Posts: 4288
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thomas Johnson wrote:Yes I do, thank you. When I run my code I'm not getting the correct output. I have searched for a fix but, I'm stuck, I can input my numbers but I'm not getting a amortization I know I'm missing something I just can't figure out what.


Your first problem is with spelling. Make sure all your variables are spelled the same way.

The second problem is more subtle and it has to do with scope. In general, declare your variables as near to where they are used as possible.

Fixing the first problem will make your program run, and fixing the second problem will make it a better program.
 
Knute Snortum
Sheriff
Posts: 4288
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thomas Johnson wrote:I fix lined 73 and this was my output???

Enter amount of loan65000
Enter interest rate per year
5.2
Enter number of years
30

Amortization Schedule for Borrower
-
-
etc.


That's exactly what the for loop in printHeader is doing. What do you want it to do?
 
Thomas Johnson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Knute I thought I made sure I had everything spelled correctly I will check my work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!