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.0
Minimum monthly payment = (Minimum monthly payment rate) x (Previous balance)
Monthly unpaid balance = (Previous balance) - (Minimum monthly payment)
Updated balance each month = (Monthly unpaid balance) + (Monthly interest rate x Monthly unpaid balance)

Note that the grading script looks for the order in which each value is printed out. We provide sample test cases below; we suggest you develop your code on your own machine, and make sure your code passes the sample test cases, before you paste it into the box below.

Test Cases to Test Your Code With. Be sure to test these on your own machine - and that you get the same output! - before running your code on this webpage!
Click to See Problem 1 Test Cases

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.

To calculate the credit card balance after one year, you can use the following steps:

1. Start by defining the variables `balance`, `annualInterestRate`, and `monthlyPaymentRate` with the provided values.

2. Calculate the monthly interest rate by dividing the annual interest rate by 12.0.

3. Iterate over 12 months using a for loop.

4. Inside the loop, calculate the minimum monthly payment by multiplying the previous balance by the monthly payment rate.

5. Subtract the minimum monthly payment from the previous balance to get the monthly unpaid balance.

6. Add the monthly interest to the monthly unpaid balance to get the updated balance.

7. Print the month number, the minimum monthly payment, and the remaining balance rounded to 2 decimal places.

8. At the end of the loop, calculate and print the total amount paid and the remaining balance, both rounded to 2 decimal places.

Here is an example implementation in Python:

```python
# Step 1: Define the variables
balance = 484
annualInterestRate = 0.2
monthlyPaymentRate = 0.04

# Step 2: Calculate the monthly interest rate
monthlyInterestRate = annualInterestRate / 12.0

# Step 3: Iterate over 12 months
for month in range(1, 13):
# Step 4: Calculate the minimum monthly payment
minimumMonthlyPayment = monthlyPaymentRate * balance

# Step 5: Calculate the monthly unpaid balance
monthlyUnpaidBalance = balance - minimumMonthlyPayment

# Step 6: Calculate the updated balance
balance = monthlyUnpaidBalance + (monthlyInterestRate * monthlyUnpaidBalance)

# Step 7: Print the monthly payment and remaining balance
print("Month:", month)
print("Minimum monthly payment:", round(minimumMonthlyPayment, 2))
print("Remaining balance:", round(balance, 2))

# Step 8: Print the total amount paid and remaining balance after one year
print("Total paid:", round(12 * minimumMonthlyPayment, 2))
print("Remaining balance:", round(balance, 2))
```

Make sure to enter your own values for `balance`, `annualInterestRate`, and `monthlyPaymentRate` before running the code.