Overview
For this assignment you will implement an GUI that displays an interest table calculator. A video of the
calculator you need to implement can be found at Video. About this project:
- There are no public/release/secret tests associated with this project.
- There is no CVS distribution (more details below).
- To submit your project you need to upload a zip file directly to the submit server (No "Submit
Project" option is available).
Objectives
- Implement Java inner classes
- Practice event-driven programming
- Learn some basic Java GUI development
Grading
- (40%) GUI
- (5%) display area
- (5%) principal text field
- (5%) rate text field
- (5%) years slider
- (5%) simple interest button
- (5%) compound interest button
- (5%) both interest button
- (5%) labels (Principal:, Rate(Percentage):, Number of Years:)
- (10%) Correct computation of simple interest
- (10%) Correct computation of compound interest
- (10%) Correct computation of both interests
- (15%) Use of Non-Anonymous inner class any button
- (15%) Use of Anonymous inner class for any button
Clarifications
Code Distribution
For this project we are not providing any code. You need to create an Eclipse
project named InterestTable. In that Eclipse project feel free to add any
classes/packages you understand you need. To simplify the grading process make
sure you have a class named InterestTableGUI.java. This class must have a
main method that allow us to run your application.
Specifications
You need to implement a GUI that displays interest tables ranging from
1 up to 25 years. The tables are generated by selecting the appropriate button
and based on the principal, rate, and years values provided. One table displays
simple interest, the second compound interest, and the third a combination of simple and
compound interest. See the provided
Video for table format
information.
Interest Formulas
The formula to compute simple interest amount is:
simple interest amount = principal + (principal * (rate/100) *
years)
The formula to compute compound interest amount is:
Compound Interest Amount = principal * (1 +
rate/100)Years
Notice that you do not need to add the principal in this case.
Displaying Currency
To display currency you can use the NumberFormat class (part of java.text)
as follows:
String formattedValue =
NumberFormat.getCurrencyInstance().format(value);
where value represents the numeric value to format.
Requirements
- Your GUI should resemble the GUI available in the video, but it does not
have to be exactly the same.
-
Make sure you have a class named InterestTableGUI.java. This class must have a
main method that allow us to execute your application.
- Keep the Model-View-Control model in mind when writing your code. Feel free to add
any classes you understand you need. The actual computation of interests should take
place in a separate class(es).
- You may only use inner classes to define event listeners.
- One of your listener objects must be implemented using an anonymous inner
class.
- One of your listener objects must be implemented using a non-anonymous
inner class.
- No student tests are required for this project.
- Your project will be graded by running the main method associated with the InterestTableGUI.java
class.
-
You can use JFrame.setDefaultLookAndFeelDecorated(true) to decorate the frame (just
make sure you call this method before you create the frame).
Additional Requirements for Students in CMSC 132H (Honors)
You must use Swing JTables in order to display the interest information. Notice
the video we provided does not rely on JTables.