Date: Mon, 11 Nov 1996 17:36:18 GMT
Server: NCSA/1.5
Content-type: text/html
Last-modified: Tue, 05 Nov 1996 12:58:06 GMT
Content-length: 6533
CS110: Program #1
Program #1 -- Automobile Financing Problem
This program is worth 20%.
Due Date
This assignment is due on Tuesday, Nov 12
Statement of the problem
You have been hired by an Automobile Financing Firm. The firm's policy is
that the customer will pay an equal amount of money
(A) each month until the loan is paid off. The monthly
payment for any particular customer is based on the amount borrowed
(B), the number of months (m) for
the loan, and the annual interest rate (i) as
in the following formula:
The amount of money borrowed (B) can be calculated as
follows:
B = P-T-D
where P is the Purchase Price of the new car,
T is the Trade-in-value of the new car and
D is the Down Payment (the first large sum of
money paid by the customer towards covering the price of the new car).
Your employer wants you you to write a C++ program to solve this
problem, even though you've only been taking C++ for a week! The
specifications of the problem are as follows:
- Your program must display messages prompting the user
for the following pieces of information:
- Price of the new car
- Trade-in value of the old car
- Down payment
- The annual percent interest rate
- The period of loan (in number of months)
- Your program must print out the following pieces of
information, with appropriate messages and in the order listed
below
- Amount borrowed
- Total number of months
- Annual percent interest rate
- Monthly payment
- Total amount paid by customer over the life of the loan
- Total interest earned over the life of the loan
- A thank you message to the user with your name in it
Test Cases
To make sure your program runs correctly, your boss asks you to
run it on the following test inputs.
- Case 1:
- Price of new car: $15000
- Trade-in-value of old car: $3000
- Down Payment : $5000
- The annual percent rate : 8%
- Period of loan : 24 months
- Case 2:
- Price of new car: $25000
- Trade-in-value of old car: $5000
- Down Payment : $7000
- The annual percent rate : 5%
- Period of loan : 36 months
What to turn in
You should turn in the following three pages, stapled together:
You will lose 2 points if items are not stapled. No exceptions!
- (page 1) Printed listing of source file (probably
should not be bigger than one page). This is to be done just like you did in program 0. Please be sure to type your name,
username(login), and section number at the top along with your comments
about what the program does.
- (pages 2 & 3) Printed output of your program
runs on the two test cases. This can be done easily as follows: After
each run of your program, you pull down the little tab button on the upper left hand corner of the output window (the one with the INACTIVE at the top), and select the Print option . This will send all output generated by your program
in this window to the printer.
- In addition, as for all assignments, you must turn in an online copy of
your program's source code. Note that once you hand in your source file,
it cannot be retrieved or changed in any way -- so be absolutely certain
that your program works before you turn it in.
Hints
- You must #include <math.h> at the beginning of your program to use the pow(x,y) function as discussed in class.
- DO NOT USE SINGLE LETTER VARIABLE NAMES IN YOUR PROGRAM.
Sample Run
To give you an idea about how your program must behave, I have provided you
with a sample run of the program:
Enter price of the new car: 30000
Enter trade-in-value of old car: 12000.3
Enter Down Payment: 3000.14
Enter the annual percent rate: 12.35
Enter the period of the loan: 36
Amount borrowed: 14999.5
Total number of months: 36
Annual percent interest rate: 12.35
Monthly payment: 500.708
Total amount paid by customer over period of loan: 18025.5
Total interest earned over life of loan: 3025.99
Thanks for using TONY D'Silva's wonderful program!
Grading
- CORRECT OUTPUT:
- USER INTERFACE:
- Meaningful prompts to user: 2
- Correct display of program output: 2
- IMPLEMENTATION:
- Correct formula implementation: 3
- Efficient formulation: 1
- Meaningful variable names: 2
- DOCUMENTATION:
- Program description: 2
- Variable definition and section comments: 2