95.3k views
3 votes
AllyBaba bank charges $10 per month plus the following check fees for a checking account: (Python)

o $.10 each for fewer than 20 checks
o $.08 each for 20-39 checks
o #.06 each for 40-59 checks
o $.04 each for 60 or more checks

Write a program that asks for the number of checks written during the past month, then computers and displays the bank's fees for the month.

Note: The program should handle an input less than 0. If any value is less than 0,
the program will display a message:
Cannot enter a negative number



SAMPLE RUN (user entry)

Bank Teller's Entry

Enter the month: September

Enter the number of checks written this month?: 10

Check Fees Summary:

Month of statement: September

For writing 10 checks, the bank fee is $11.00

AllyBaba bank charges $10 per month plus the following check fees for a checking account-example-1

1 Answer

3 votes

Answer:

Here's a Python program that should do what you described:

# Get user input for month and number of checks written

month = input("Enter the month: ")

num_checks = int(input("Enter the number of checks written this month: "))

# Calculate the fees based on the number of checks written

if num_checks < 0:

print("Cannot enter a negative number")

elif num_checks < 20:

fees = 10 + (num_checks * 0.10)

else:

if num_checks < 40:

fees = 10 + (num_checks * 0.08)

else:

if num_checks < 60:

fees = 10 + (num_checks * 0.06)

else:

fees = 10 + (num_checks * 0.04)

# Print the fee summary

if num_checks >= 0:

print("\\Check Fees Summary:")

print("Month of statement:", month)

print("For writing", num_checks, "checks, the bank fee is $%.2f" % fees)

Step-by-step explanation:

User Leone
by
7.7k points