In: Computer Science
A bank charges $10 per month plus the following check fees for a commercial checking account: $.10 each for less than 20 checks $.08 each for 20 - 39 checks $.06 each for 40 - 59 checks $.04 each for 60 or more checks Write a program that prompts the user for the number of checks written each month. Then compute and display the bank’s total service fees for the month. Make sure the output displays with a $ and 2 decimal places. Also, use input validation to handle possible errors in the user input. This program MUST use a decision structure. im using python please help.
total_fees = 0 # variable to store total fees
month = 1 # month counter
# using while to calculate the fees for each month and calculate total fees for each month
while(month <= 12):
fixed_charges = 10 # initializing fixed charges
monthly_fee = fixed_charges # variable to store monthly fee
# using a try-except block to validate inputs
while True:
# prompt to ask user for numeber of checks written each month
checks = input('Enter the number of checks wirtten in month {}: '.format(month))
try:
checks = int(checks)
except ValueError:
print('Valid number, please')
continue
if 0 <= checks:
break
else:
print('Please enter a valid number')
# using if-elif structure to calculate the additional charges and hence total monthly fee
if checks < 20:
check_fees = 0.1
monthly_fee += check_fees * checks
elif checks >= 20 and checks < 40:
check_fees = 0.08
monthly_fee += check_fees * checks
elif checks >= 40 and checks < 60:
check_fees = 0.06
monthly_fee += check_fees * checks
elif checks >= 60:
check_fees = 0.04
monthly_fee += check_fees * checks
# increment the month counter
month += 1
# add monthly charges to total fees
total_fees += monthly_fee
print(monthly_fee)
# display the result
print('Total Bank Charges are: ${}'.format(round(total_fees, 2)))

FOR HELP PLEASE COMMENT.
THANK YOU