ASSIGNMENT 2: CSUS
MORTGAGE Ver 2.0 top Solution: CSUSMortgageV2.zip
The purpose of this assignment is to provide you with a
comprehensive exercise to practice the following material (Chapters 4, 5, 7,
and 8):
-
Making
decisions
-
Validating
input
-
Writing
event procedures
-
Creating
Menus
-
Writing
functions
-
Using
loops
-
Using
arrays
Interface Description:

Figure 2.1
-
Create the interface shown in Figure 2.1
-
Menu hierarchy has the following menus: File/Exit,
View/Amortization, View/Clear, Help/About. A separator used used between
View/Amortization and View/Clear.
-
In the details group box, all components are labels with
Courier New font.
-
The annual interest rate text box is disabled (cannot
change content).
-
Calculate button is disabled.
Implementation Description:
Class
Diagram
- Create methods shown in the class diagram above:
- When home value and down payment text boxes are filled and are
numeric, the calculate button is enabled. Also, the findInterestRate
method is called to find and display the interest rate from the interest
rate table. Show appropriate error messages if not numeric data is typed
and disable the calculate button.
- Interest rate is calculated based on the following table (must create
an array of arrays to search the table for the appropriate interest
rate):
Amount is |
But not over |
5 year rate |
15 year rate |
30 year rate |
0 |
100,000 |
0.0475 |
0.0525 |
0.065 |
100,000 |
250,000 |
0.045 |
0.05 |
0.0638 |
250,000 |
1,000,000 |
0.04125 |
0.04575 |
0.0625 |
1,000,000 |
|
0.0375 |
0.0425 |
0.06125 |
- Interest rate is discounted by 0.001 for state employees.
- When radio buttons or the employee check box is clicked, the new
interest rate is automatically found and displayed.
- The calculate button calculates and displays all detail labels
(monthly amounts).
- Loan amount is Home value - Down payment
- Payment and interest is the same calculation as assignment 1 (pmt
function).
- Taxes is 1.25% per year of the home value.
- Insurance is charged only when the down payment is less than 20%
of the home value. Insurance is 0.005 of the loan amount per year.
- PITI is the sum of Payment, Interest, Taxes, and Insurance.
- Gross Income to qualify is PITI/0.3
- File/Exit exits application.
- View/Clear sets the form to its initial state.
- Help/About shows the following message box:
Figure 2.2
- View/Amortization shows the Amortization report similar to the one
shown in Figure 2.3 (only last page of the report is shown). To print
the report:
Figure 2.3
-
Go to a loop for the number of months defined by the
Loan Years variable. Inside the loop the logic for the data in each of
the columns is the following:
-
Month: Is a serial number that starts from 1 and
ends with the number of months in the Loan Years (Loan Years times
12)
-
Mortgage PMT: A constant payment for the entire loan
period (calculated by the pmt function)
-
Interest PMT: The interest expense for each month
(calculated by the ipmt function) using the loan balance
-
Monthly Equity: The equity gains for this month; is
the difference between Mortgage PMT and Interest PMT
-
Total Equity: The accumulated equity (sum of
previous Equities)
-
Loan Balance: Loan balance - Monthly Equity
-
If the calculate button has not been pressed and there
is no PITI in label, the following message will be displayed:
Figure 2.4
- formatMonthColumn function receives a month and returns a string with
the month right-padded with spaces till the string becomes 5 characters
long.
- formatCurrencyColumn function receives a double amount and returns a
string with the amount formatted as currency with spaces left-padded
till the string becomes 14 characters long. If the formatted number does
not fit in the 14 characters column size, the overflow symbol
(##############) is displayed.
- Both functions above are used to align the columns for the report.
- Report is printed in Courier New font size 12.
- First 3 lines are printed in all pages of the report.
|