# Write a program

Write a program which calculates and displays the cash flow for a given loan. The type of the loan is equal instalments, i.e. the interest amount reduces when the principal amount reduces. You can assume monthly payments and that exactly one month passes from the issue date to the first instalment and that monthly interest rate is equal to yearly interest rate / 12. The main program asks the user for the principal amount, yearly interest rate, and the number of instalments. Then the program displays the projected cashflow, i.e. for each instalment it displays the instalment number, the remainder of the principal, the instalment amount, the interest paid, and the total amount.

you need to modify the class Loan and the function readData(). the following main is given:

int main()

{

double amount, interestRate;

int numPayments;

readData(amount, interestRate, numPayments);

Loan myLoan(amount, interestRate, numPayments);

myLoan.displaySchedule();

return 0;

}

Example

Principal: 120000

Interest rate: 10

Number of payments: 12

No.        Balance     Instalment       Interest  Total payment

----------------------------------------------------------------

1      120000.00       10000.00        1000.00       11000.00

2      110000.00       10000.00         916.67       10916.67

3      100000.00       10000.00         833.33       10833.33

4       90000.00       10000.00         750.00       10750.00

5       80000.00       10000.00         666.67       10666.67

6       70000.00       10000.00         583.33       10583.33

7       60000.00       10000.00         500.00       10500.00

8       50000.00       10000.00         416.67       10416.67

9       40000.00       10000.00         333.33       10333.33

10       30000.00       10000.00         250.00       10250.00

11       20000.00       10000.00         166.67       10166.67

12       10000.00       10000.00          83.33       10083.33

----------------------------------------------------------------

120000.00        6500.00      126500.00

the first 3 lines are input the rest is output, the width of the No column is 3 the rest are 15 and thr lines consist of 64 "-" characters