CS 150 - Intro to Programming - Spring 2001
| CS150 | Labs
| Projects | Assignments
| CodeSamples | Help
Resources | Style Guide |
Programming Project 2 - 15 points
Due: Thursday September 27th by 2:30pm
Design, implement and test a C++ program that prints a payment schedule
for a debit given the initial loan amount, the annual interest rate and
a payment amount. Consider the following example: A person has a debt of
$1000.00 at an annual interest rate of 10% and wants to make a payment
of 100.00 a month.
Sample program run - User input in bold
Welcome to the Loan Payment Program
Enter loan amount : 1000
Enter interest rate : 10
Enter payment amount: 100
Payment Balance interest principle
1 1008.33 8.33 91.67
2 915.90 7.57 92.43
3 822.70 6.80 93.20
4 728.72 6.02 93.98
5 633.96 5.24 94.76
6 538.41 4.45 95.55
7 442.07 3.65 96.35
8 344.92 2.85 97.15
9 246.96 2.04 97.96
10 148.18 1.22 98.78
Final Payment of : 48.18
Do you wish to continue? Enter Q to quit anything else to continue: y
Welcome to the Loan Payment Program
Enter loan amount : 1000
Enter interest rate : 10
Enter payment amount: 125
Payment Balance interest principle
1 1008.33 8.33 116.67
2 890.69 7.36 117.64
3 772.08 6.38 118.62
4 652.47 5.39 119.61
5 531.86 4.40 120.60
6 410.25 3.39 121.61
7 287.63 2.38 122.62
8 163.99 1.36 123.64
Final Payment of : 38.99
Do you wish to continue? Enter Q to quit anything else to continue: q
An algorithm for solving this problem will be given in lecture.
Your program should print a header and prompt the user to enter the
loan amount, the interest rate, and the amount of the payment. You may
assume that only valid and reasonable inputs will be entered (i.e You don't
need to do any range checking on the input). Use appropriate data type
for your variables. Note that the interest rate needs to be a decimal number
when doing calculations (7.25% = .0725 => 7.25/100 = .0725). Once the data is entered, your
program should output a report including the payment number, the remaining balance, the amount of interest, the amount applied to the principle and the final payment. All values should be output to TWO decimal place accuracy and aligned in columns as shown above (Hint: use setw() from the iomanip library). User
should be allowed to run the program until they choose to quit.
Notes:
-
You must use while or do / while loops for this project do
not use for loops.
-
Follow the program development process (analysis - design - implementation
- testing).
-
Pseudo code will be most helpful.
-
Develop at least three test cases BEFORE you start writing C++ code.
-
Add only a few lines to your source code at a time.
-
Compile and run your program each time you add a new feature or correct
a bug (sometimes fixing one bug creates new ones!).
-
It is easier to test a program that has only a few changes, than it is
to test one that has a lot of new code.
-
Get the input and calculation phase to work for a single case before trying
in a loop.
-
Get the calculation loop working before adding the outer loop.
-
Be sure to document your source file, and use the good indenting and spacing
as described in the style guidelines and discussed in class.
-
Review the Lab Guidelines and the Programming
Projects information (be sure to read and understand the Policy
on Collaboration ).
What to Turn In:
electronic version files: Due: Thursday September 27th by 2:30pm
-
yourLastNameP2 (folder with other files)
-
yourLastNameP2.cpp
paper version: Due: Thursday September 27th by 2:30pm