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

Write a program that calculates the balance of a savings account at the end of a

ID: 3830501 • Letter: W

Question

Write a program that calculates the balance of a savings account at the end of a the three month period. It should ask the user for the starting balance and the annual interest rate. A loop should then iterate once for every month in the period, performing the following steps: A) Ask the user for the total amount deposited into the account during that the month and add it to the balance. Do not accept negative numbers B) Ask the user for the total amount withdrawn for the account during that month and subtract it from the balance. Do not accept negative numbers or numbers greater than the balance after the deposits for the negative numbers or numbers greater than the balance after the deposits for the month have been added in c) Calculate the interest for that month. The monthly interest rate is the annual interest rate dividend by 12. Multiply the monthly interest rate by the average of that month's starting and ending balance to get the interest amount for the month. This amount should be added to the balance After the last iteration, the program should display a report that includes the following information: starting balance at the beginning of the three-months period total deposits made during the three months total withdrawals made during the three months total interest posted to the account during the three months final balance starting balance: 26000 Annual interest rate (%): 3.25 Month 1; Deposit 4500, withdrawal 3400 Month 2: Deposit 3700, withdrawal 2800 month 2; Deposit 410, withdrawal 3500 Interest is computed on the average of starting and ending balance for each month.

Explanation / Answer

try:
starting_balance = int(input("Enter the atarting Balance of your account : "))
annual_interest_rate = float(input("Enter the Annual Interest Rate in percent(100 not in decimals) : "))
except:
print("Entered Values are not in the proper type(int/float)")

total_deposits = 0
total_withdrawls = 0
total_interest_added = 0

print("Starting Balance : ", starting_balance)
print("Annual Interest Rate(%) : ", annual_interest_rate)
for i in range(3):
starting_amount = starting_balance
dep_amount = float(input("Enter the amount Deposited in month " + str(i+1) + " : "))
total_deposits += dep_amount
if dep_amount >= 0:
starting_balance += dep_amount
else:
print("Deposited Amount must be a positive integer")
break
withdrawn_amount = float(input("Enter the amount i.e with drawn in the month" + str(i+1) + " : "))
total_withdrawls += withdrawn_amount
if withdrawn_amount >=0 and withdrawn_amount <= starting_balance:
starting_balance -= withdrawn_amount
  
else:
print("Withdrawn amount you have entered is either negative or more than the available amount")
break
monthly_interest_rate = annual_interest_rate/12
ending_amount = starting_balance
average_val = (starting_amount + ending_amount)/2
monthly_interest_val = (average_val * monthly_interest_rate)/100
print("Month " + str(i+1) + " : " + "Deposit " + str(dep_amount) + ", Withdrawl " + str(withdrawn_amount))
print("Monthly interest val " + str(i+1) + " : " + str(monthly_interest_val))
starting_balance += monthly_interest_val
total_interest_added += monthly_interest_val
print("ending balance after adding interest in month " + str(i+1) + " : " + str(starting_balance))

print(' ')
print("Total Deposits Made in 3 months : ", total_deposits)
print("Total Withdrawls made in 3 months : ", total_withdrawls)
print("Total Interest added in 3 months : ",total_interest_added)
print("Final Balance" ,starting_balance)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote