CSC 160 - Program #5

Mortage Calculator

Assigned: Weds Feb 19, 2003 Program #5 is worth 75 points
Program due: Weds Feb 26, 2003  

Concepts

In this program you will use the following "new" concepts:

  • Classes and Objects
  • Multiple-file programs
  • Mortgages... for those young people who haven't had one yet

 


Description

Implement the Mortgage calculator described in Programming Challenge 7.8 on page 488 of our text.

Here's an example session:

Welcome to Mortgage Calculator
 
Enter the loan amount (in dollars):
100000
Enter the annual interest rate (in percent, ie 6.0, 7.5):
6
Enter the term (in years) of the loan:
15
 
*** Mortgage Report ***
    Loan amount      $ 100000.00
    Interest Rate           6.00%
    Term                   15   years
 
    Monthly Payments $    843.86
    Total Payments   $ 151894.23
 

 


Implementation

Your implementation of the Mortgage Calculator must define a new class. I called mine Mortgage, and I will use that as a reference point in the notes below.

The Mortgage class must have:

  • Private member variables to store the loan amount, interest rate and number of years of the loan.
  • Public member functions:
    • For setting and getting the loan amount, interest rate, and number of years: for example setLoanAmount(), getInterestRate().
    • That returns the monthly payment amount of the loan
    • That returns the total payments over the life of the loan

Your main() must create an object that is an instance of this class. This object is used to generate reports regarding the loan.

Your program must have 3 files:

  1. Client file - containing the functions that create and use objects; main() resides here... I called mine prog05.cpp
  2. Header file - containing class definition... I called mine Mortgage.h
  3. Implementation file - containing the code that implements public member functions... I called mine Mortgage.cpp 

You must include Mortgage.h in prog05.cpp, like this:

#include "Mortgage.h"

You must also include Mortgage.h in Mortgage.cpp. Just like prog05.cpp, Mortgage.cpp has to include any other that it references (iostream, string, cmath, etc.).

Also, these files must all be part of your Visual C++ project. You can add a file to your project using the menu choice Project/Add To Project/Files.

We will also do/discuss this in lab. This is introduced at page 445 in our text, in developing the Rectangle class. Check it out.

 


Grading

Your program will be graded on three areas: design, quality, and function

Design (20%)

Your design must include detailed pseudo-code describing how your program will function. Please use the Pseudo-Code Quick Reference as a guide.

Quality (20%)

Your code should be well-commented, properly indented and structured, and contain informative and consistent names.

Function (60%)

Your program must implement the program features per the description above.

Place any comments you have in your README file.

 


Notes

Test cases will be detailed (shortly) in README.txt in the prog05 folder.