CS243-PA3-LoanPayment.docx

CS225 Fundamentals of Computer Science Course Syllabus Fall 2013

Dr. Simon Lin Version: 09/02/2013

CS243 Programming in C++ Project Assignment 3 (PA3) Dr. Lin Version 3/24/19

PA 3 – Loan Payment Report

Please write a C++ program to generate a detail loan payment report from the first month until the loan balance becomes zero or less than ten cents.

You have just purchased a sound system that cost $1000 on the following credit plan (as test case #1 ):

No down payment, annual simple interest rate of 18.00% (and hence 1.50% per month or 0.015 per month), and monthly payments of $50.00. The monthly payment of $50.00 is used to pay the interest and whatever is left is used to pay part of the remaining debt. Hence, the first month you pay 1.5% of $1000 in interest, which is $15.00. So, the remaining $35.00 (=$50.00 -$15.00) is deducted from your loan balance, which leaves you with a debt of $965.00 (=$1000.00 - $35.00). The next month, you pay interest of 1.5% of 965, which is $14.48. Hence, you can deduct $35.52 (=$50.00 - $14.48) from your loan balance.

You may use a while loop such as: while (loanBalance >= monthPayment) { … }.

When the loanBalance is less than the monthPayment, you need to compute the final payment amount, which should be the loanBalance plus its interest of one month.

For example, if your last-month’s loan balance is $47.12, which is less than the monthly payment of $50.00, then its final payment should be $47.83 because $47.12 plus its interest $0.71 (= 47.12 * 0.015) is $47.83.

Please make sure that your report is very user-friendly and easy to read.

Your report must first show the following headline: (for example)

Loan amount: $1000.00 Annual Interest Rate: 18.00% Monthly Payment: $50.00

Your report must then have the following 5 columns for each month’s payment until the loan balance is equal to 0 or less than 0.10:

Month # // Start from 1 for first month, 2 for second month, and so on

Month-Payment // Same for every month until the very last payment to pay off the loan balance

Interest-Paid // current_loanBalance * Monthly_Interest_Rate

Debt-Paid // monthPayment - Interest_Paid

Loan-Balance // Last_Month_loanBalance - Debt_Paid

Your report must have the following line at the end to show the total interest amount being paid:

Total Amount of Interest Paid: $______________

========================================================================.

You must run the following 3 test cases for this assignment.

Your test case #1 is:

Loan amount: $1000.00 Annual Interest Rate: 18.00% Monthly Payment: $50.00

Your test case #2 is:

Loan amount: $1000.00 Annual Interest Rate: 18.00% Monthly Payment: $100.00

Your test case #3 is:

Loan amount: $1000.00 Annual Interest Rate: 18.00% Monthly Payment: $180.00

=========================================================================.

Your loan payment report for test case #1 must look as follows:

Loan amount: $1000.00 Annual Interest Rate: 18.00% Monthly Payment: $50.00

Month# Month-Payment Interest-Paid Debt-Paid Loan-Balance

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

1 $50.00 $15.00 $35.00 $965.00

2 $50.00 $14.48 $35.52 $929.48

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

21 $50.00 $2.86 $47.14 $143.53

22 $50.00 $2.15 $47.85 $95.68

23 $50.00 $1.44 $48.56 $47.12

24 $47.83 $0.71 $47.12 $0.00

Total Amount of Interest Paid: $197.83

======================================================================.

How to submit your Lab or Project Assignment (PA)?

(1) Each program must be well documented with block comments and proper line comments.

The beginning of each program must have a block comment to show its author, date, and purpose.

The following is an example of block comments:

// Author: You must use your full name here!

// Date: You must put today’s date here!

// Purpose: . . . You must show the purpose of this program here!

(2) You must submit to Canvas the following 2 items as attachments:

(a) Your source program (for example, CS243-PA3.cpp ), and

(b) Your WORD document (for example, CS243-PA3-report .docx ) containing the listing of

your C++ program, and the output of 3 test runs of your program (as shown below).

=========================================================================.

// Please delete everything above this line to make this your Word document to be submitted.

PA3 Report My Name: ________________

The following is my C++ source program:

// Please copy your source program into here from your Visual Studio window. The code must be colored.

// You must not copy source program from your PA3.cpp file since the code over there is not colored at all.

The following is the output of 3 test runs of my program:

// One way to copy the console output is press Ctrl+Alt+PrtScn. To paste it is to press Ctrl+v.

// Please copy your console output and paste into here:

Page 1 of 1

Page 1 of 2