Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java GUI loan and payment calculator help

 
mike saggese
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey there, I'm new to Java and I need help with this assignment: Write a Java program to calculate and display monthly and total payments given interest starting from 3% to 6% (with an increment of 0.125%). The user inputs are loan amount and loan period (i.e., number of years).

Here's what I have so far



I also have this code as reference to what I want to do but isn't exactly how I want it done



If anyone can help me make heads or tails of anything that would be great thanks
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a problem or question with the code? Are you stuck someplace? TellTheDetails (<-link)
 
mike saggese
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve Luke wrote:Do you have a problem or question with the code? Are you stuck someplace? TellTheDetails (<-link)


Yes. My gripe is where do I put the interest rate and monthly payment and total payment formula for the show table button to calculate the loan?
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My suggestion would be in a different class. Have a class whose sole purpose is to maintain a balance, total term, take a percentage rate as a value, and generate the payment amount.

I would create a small gui-less example (like the second code) to test out the class to make sure that the class does what you need it to do.

Then I would use the information learned from the gui-less example (i.e. what methods have to be called in what order) to generate the functionality of your actionPerformed method in your GUI.
 
mike saggese
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve Luke wrote:My suggestion would be in a different class. Have a class whose sole purpose is to maintain a balance, total term, take a percentage rate as a value, and generate the payment amount.

I would create a small gui-less example (like the second code) to test out the class to make sure that the class does what you need it to do.

Then I would use the information learned from the gui-less example (i.e. what methods have to be called in what order) to generate the functionality of your actionPerformed method in your GUI.


I did a little more with the code. How about this?



for some reason however I keep getting an error on line 81 saying illegal start of expression. how do I fix that?
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mike saggese wrote:for some reason however I keep getting an error on line 81 saying illegal start of expression. how do I fix that?

Look at line 81 carefully, you are declaring the incrementRate() without ending actionPerformed().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic