Department of Computer
Science
CMSC132:
Fall 2012
Homework: GUI/Inner Classes
Due Date: Sunday September 30, 11:00 pm
Assignment Type: Open (See
Policy)
For this homework you will implement an interest calculator. A video of the calculator you need to implement can be found at Video.
Notice that there are no public/release/secret tests associated with this project. In addition, you do not need to provide any student tests.
This project is designed to help you develop your skills at defining inner classes and simple GUIs.
For this project we are not providing any code (we just defined a package). We are providing an empty code distribution (available by checking out the project named Fall2012Proj3) so you can submit your project as usual. Feel free to add any classes/packages you understand you need. To simplify the grading process, make sure you have in the calculator package a class named InterestGUI.java. This class must have a main method that allows us to execute the calculator program.
You need to implement a GUI for a calculator that computes simple and compound interest. 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.
To display currency you can use the NumberFormat class (part of java.text) as follows:
String formattedValue =
NumberFormat.getCurrencyInstance().format(value);