PROGRAM #4 (AMORTIZATION WITH A MENU)



[pic]

ITP-100 Lab10: An Amortization Table Name: _____________________________________

Due Date: April 8, 2008 (has neither given nor received aid on this program)

Problem: Write a useful C++ computer program to generate a table of payments, principle, interest, and balance. These columns are based upon three inputs: loan amount, annual interest rate, and number of years. These are input from the keyboard by the user.

The program will employ the round() function that returns a double, written by your humble instructor. It actually rounds to a user specified number of decimals. In this case it rounds to two decimals. Also, this program will re-use a previously defined function from Lab8 payCalc() that returned a monthly payment (double).

One important requirement is for the student to use functions that “pass by reference” and “pass by value” discussed in class. This program should clarify the differences in each type.

Another requirement is for the student to modurlarize this program by the use of several functions. Our class discussion will explain these in more detail. The Structure Chart attached to this specification sheet shows the relationship between these modules (functions). Notice the black triangle at the upper left corner of the round function. This indicates calls by more than 1 function.

Please comment your program heavily! This is done for the reader and for you, so that you will understand what was done even years from the time you wrote the code.

The getData() function will accept three data items from the user: amount financed, annual interest rate in percent, and number of years financed. Its parameters will be passed by reference.

Totals at the bottom of each report will be accumulated. Accumulate the total payments, total interest, and total paid to principal.

Format and Creativity: This program should be properly spaced with aligned decimal points for each column shown. The spacing is up to you as a programmer. If you have time, you may get an additional 5 points for adjusting the last payment to arrive at a zero balance. If you attempt the extra credit, you should conditionally check for the last payment and may have to add or subtract a small amount of change to the interest and principle.

Checklist (items to include):

1. Program Source Code (C++ Program with line numbers)

3. Structure Chart showing each function used in this program.

5. Print Spacing Chart of your display & aligned decimal spacing.

6. Three (3) sample outputs (one for each of these): 1 year, 4 years, and 10 year loan tables. Each should show different beginning amounts and different interest rates.

7. Answers to the following questions:

Questions (Answer in several sentences about each question):

a. Define “pass by value” and “pass by reference” to a new C++ Programmer.

b. What are the advantages and disadvantages of each of these?

c. What does the black triangle in the upper left corner of a Structure Chart indicate?

d. Specifically, what gave you the most difficulty in this Lab?

Submitted:

Electronically, in the usual way: Lab10.cpp, Lab10.psc, and sample Lab10a.out, Lab10b.out, and Lab10c.out.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download