Program 1 - Credit Card

Comp 170

 

 

Write a C++ program that will calculate the monthly finance charge and balance of a credit card given the initial balance, the credit card's APR, the monthly amount charged to the card, and the monthly payment made on the card. 

 

The finance charge (F/C) is computed as the account balance times the MPR before the month's charges or payments are made.

 

Your program should produce output exactly like the example below.  The program stops computing once the credit card has been paid off (balance less than or equal to 0).

 

 

Initial balance? 1000

Interest rate?   12.5

Monthly charge?  50

Monthly payment? 250

 

Month     F/C     Balance

  1     10.42      810.42

  2      8.44      618.86

  3      6.45      425.30

  4      4.43      229.74

  5      2.39       32.13

  6      0.33        0.00

 

Your Last payment was 82.46

 

 

Any positive dollar amount, interest rate, monthly charge, or monthly payment may be entered by the user.

 

To create the aligned columns, you will need to use the setw function in the iomanip.h library.  There are 5 spaces between "Month" and "F/C" and "F/C" and "Balance".

 

* If for some reason the credit card balance cannot be paid off, your program should report: “Card cannot be paid off.” and not produce a table.

 

 

Turn in your program  (CreditCard.cpp) on Easel.