• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Java GUI loan and payment calculator help

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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().
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic