180k views
1 vote
Code a program that asks the user for a bank savings account balance and an annual interest rate that is paid to the account. You are to display what the balance will be after one year, after two years, and after three years. We can assume that the interest compounds annually (no need to ask for compounding criteria or use the natural number for continuously compounding interest, whew!) If the balance after adding the interest paid to the user exceeds $1000 then let the user know that they are now a silver bank club member. If it exceeds $5000 then let the user know that they are now a gold bank club member. If it exceeds $10000 then let the user know that they are now a platinum bank club member. If they qualify for any of these exclusive member statuses then you should tell them by how much they are exceeding the minimum balance for that status.

The interest rate will need to be input whole numbers (ex: 15), but *hint* remember that you will need to divide by 100 to obtain the rate expressed as a decimal.
A- The structure of the program must follow the sample programs provided in the text.
B- The program will need to provide clear, explicit instructions.
C- The program will need to display clear statements for the balance and exceeding amount for the exclusive club status for each year.

1 Answer

1 vote

Answer:

is_silver = False

is_gold = False

is_premium = False

balance = float(input("Enter the balance: "))

rate = float(input("Enter the annual interest rate: "))

for i in range(3):

balance += balance * 0.15

print("The balance after " + str(i+1) + " year is $" + str(balance))

if balance > 10000 and is_premium == False:

print("You are now a premium bank club member.")

is_premium = True

print("You are exceeding " + str(balance - 10000) + "$ for that status")

elif balance > 5000 and is_gold == False and is_premium == False:

print("You are now a gold bank club member.")

is_gold = True

print("You are exceeding " + str(balance - 5000) + "$ for that status")

elif balance > 1000 and is_silver == False and is_gold == False and is_premium == False:

print("You are now a silver bank club member.")

is_silver = True

print("You are exceeding " + str(balance - 1000) + "$ for that status")

Step-by-step explanation:

*The code is in Python.

Set the is_silver, is_gold and is_premium as False

Ask the user to enter the balance and rate

Create a for loop that iterates three times. Inside the loop:

Add the interest to the balance (cumulative sum)

Print the balance

Check the balance. If it is greater than 10000 and is_premium is False, state that the customer is a premium member, set the is_premium as True, and state how much s/he is exceeding the minimum balance for that status. If the balance is greater than 5000, is_gold is False and is_premium is False, state that the customer is a gold member, set the is_gold as True, and state how much s/he is exceeding the minimum balance for that status. If the balance is greater than 1000, is_silver is False, is_gold is False and is_premium is False, state that the customer is a silver member, set the is_silver as True, and state how much s/he is exceeding the minimum balance for that status.

User Ellie Zou
by
7.2k points