Answer:
balance = float(input("Enter the current credit card balance: "))
purchases = float(input("Enter the amount of new purchases: "))
payments = float(input("Enter the amount of all payments: "))
unpaid = purchases - payments
if unpaid >= 0 and unpaid < 100:
balance = balance + payments - purchases - (unpaid * 0.08)
elif unpaid >= 100 and unpaid <= 500:
balance = balance + payments - purchases - (unpaid * 0.12)
else:
balance = balance + payments - purchases - (unpaid * 0.16)
print("The balance is " + str(balance))
Explanation:
*The code is in Python.
Ask the user to enter the balance, amount of purchases, and amount of payments
Calculate the unpaid balance, subtract payments from purchases
Check the unpaid balance. If it is smaller than 100, calculate the new balance, add payments, subtract purchases and the 8% interest of unpaid balance. If it is between 100 and 500, calculate the new balance, add payments, subtract purchases and the 12% interest of unpaid balance. If it is greater than 500, calculate the new balance, add payments, subtract purchases and the 16% interest of unpaid balance
Print the balance