Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PAYING THE MINIMUM : Write a program to calculate the credit card balance after

ID: 3652124 • Letter: P

Question

PAYING THE MINIMUM :

Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each month.

The following variables contain values as described below:

balance - the outstanding balance on the credit card

annualInterestRate - annual interest rate as a decimal

monthlyPaymentRate - minimum monthly payment rate as a decimal

For each month, calculate statements on the monthly payment and remaining balance, and print to screen something of the format:


Month: 1
Minimum monthly payment: 96.0
Remaining balance: 4784.0
Be sure to print out no more than two decimal digits of accuracy - so print


Remaining balance: 813.41
instead of


Remaining balance: 813.4141998135
Finally, print out the total amount paid that year and the remaining balance at the end of the year in the format:


Total paid: 96.0
Remaining balance: 4784.0
A summary of the required math is found below:

Monthly interest rate= (Annual interest rate) / 12
Minimum monthly payment = (Minimum monthly payment rate) x (Previous balance)
Updated balance each month = (Previous balance - Minimum monthly payment) x (1 + Monthly interest rate)

Note that the grading script looks for the order in which each value is printed out and the colon separating the description and the number.

The code you paste into the following box should not specify the values for the variables balance, annualInterestRate, or monthlyPaymentRate - our test code will define those values before testing your submission.

Explanation / Answer

#include #include #include Void main(); { long balance,annualInterestRate,monthlyPaymentRate,Monthly interest rate; clrscr(); Printf("Month: 1 Minimum monthly payment: 96.0 Remaining balance: 4784.0 Remaining balance: 813.41 instead of Remaining balance: 813.4141998135 Total paid: 96.0 Remaining balance: 4784.0 Total paid: 96.0 Remaining balance: 4784.0"); Monthly interest rate= (Annual interest rate) / 12; Minimum monthly payment = (Minimum monthly payment rate) x (Previous balance) Updated balance each month = (Previous balance - Minimum monthly payment) x (1 + Monthly interest rate); } Getche(); }