Question

Using Python write a code for Function 1: A bank charges $10 per month plus the...

Using Python write a code for Function 1: A bank charges $10 per month plus the following check fees for a commercial checking account:

a. $0.10 each for 1-19 checks

b. $0.08 each for 20-39 checks

c. $0.06 each for 40-59 checks

d. $0.04 each for 60 or more checks.

(Note that the same fee is charged for all checks. If the customer writes 21 checks, all 21 checks are billed at the $0.08 rate.)

The bank also charges an additional $15 if the balance of the account falls below $400 (after applying the $10 fee but before any check fees are applied).

Write a function named getFees() which takes two arguments: one representing the account balance, and the other representing the number of checks written during the past month. This function returns a value representing the total amount that will be charged in fees for this month. If the account balance is 0 or less, ask again so the user will enter a valid input. If the number of checks is 0 or less, ask again so the user will enter a valid input. Note that the function just returns the amount. We display the amount when we call the function.

For example, getFees(1000.0, 14) would return 11.4 (the basic $10 fee plus 14 * 0.1 for the checks). getFees(250.75, 50) would return 28.0 (the basic $10 fee, plus a $15 penalty for falling below $400.00, plus 50 * 0.06 for the checks).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

def getFees(initBalance,checks):

import sys

if initBalance<=0:
print('Enter valid input for initial balance')
sys.exit(1) #terminate the program with error
  

monthlyCharges = 10;
extraFee = 0;
serviceFee = 0;
if(initBalance<400):
extraFee = 15;
if(checks<20):
serviceFee = 0.1*checks + monthlyCharges + extraFee;
elif(checks>=20 and checks<=39 ):
serviceFee = 0.08*checks + monthlyCharges + extraFee;  
elif(checks>=40 and checks<=59 ):
serviceFee = 0.06*checks + monthlyCharges + extraFee;  
elif(checks>=60 ):
serviceFee = 0.04*checks + monthlyCharges + extraFee;  
return serviceFee;

COMMENT DOWN FOR ANY QUERY RELATED TO THIS ANSWER,

IF YOU'RE SATISFIED, GIVE A THUMBS UP

Add a comment
Know the answer?
Add Answer to:
Using Python write a code for Function 1: A bank charges $10 per month plus the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Must be written in C++ Bank Charges A bank charges $15 per month plus the following...

    Must be written in C++ Bank Charges A bank charges $15 per month plus the following check fees for a commercial checking account: $0.10 per check each for fewer than 20 checks (1-19) $0.08 each for 20–39 checks $0.06 each for 40–59 checks $0.04 each for 60 or more checks Write a program that asks for the number of checks written during the past month, then computes and displays the bank’s fees for the month. Input Validation: Display an error...

  • Python Question A bank charges a base fee of $10 per month plus the following check...

    Python Question A bank charges a base fee of $10 per month plus the following check fees for a commercial checking account: $.10 each for less than 20 checks $.08 each for 20 to 29 checks $.06 each for 40 to 59 checks $.04 each for 60 or more checks Write a program that asks for the number of checks per month (integer) and displays the fee for the month.

  • Java Bank program A bank charges a base fee of $10 per month, plus the following...

    Java Bank program A bank charges a base fee of $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 asks for the number of checks written for the month. The program should then calculate and display the bank’s service fees for the month.

  • C++ A bank charges $10 per month plus the following check fees for a commercial checking...

    C++ A bank charges $10 per month plus the following check fees for a commercial checking account: $.10 each for fewer than 20 checks $.08 each for 20-39 checks $.06 each for 40-59 checks $.04 each for 60 or more checks The bank also charges an extra $15 if the balance of the account falls below $400 (before any check fees are applied). Write a program that asks for the beginning balance and the number of checks written. Compute and...

  • Must be written in C++ Bank Charges A bank charges $15 per month plus the following...

    Must be written in C++ Bank Charges A bank charges $15 per month plus the following check fees for a commercial checking account: $0.10 per check each for fewer than 20 checks (1-19) $0.08 each for 20–39 checks $0.06 each for 40–59 checks $0.04 each for 60 or more checks Write a program that asks for the number of checks written during the past month, then computes and displays the bank’s fees for the month. Input Validation: Display an error...

  • Im opening a corporate bank account. Bank A charges a fixed monthly fee of $120 plus...

    Im opening a corporate bank account. Bank A charges a fixed monthly fee of $120 plus 10 cents per check written. Bank B charges a fixed monthly fee of $100 plus 14 cents per check written. (a). Sketch the graphs of the functions A(x) and B(x) which represents the monthly cost of banking at the two banks, where x is the number of checks written in the month. Label the y-axis intercepts and find the coordinates of the point where...

  • Create an Inheritance hierarchy that a bank may use to represent customer's bank accounts (Checking and...

    Create an Inheritance hierarchy that a bank may use to represent customer's bank accounts (Checking and Savings), this includes a GUI user interface that allows user to login, and deposit or withdraw, and application to display the transaction and final balance. All the bank customers can: - Create a new account - Deposit (Credit) money into their account and/or withdraw (debit) money from their account. - Application should expect user to login to their account using login/password Create necessary classes...

  • Java project: A Bank Transaction System For A Regional Bank User Story A regional rural bank...

    Java project: A Bank Transaction System For A Regional Bank User Story A regional rural bank CEO wants to modernize banking experience for his customers by providing a computer solution for them to post the bank transactions in their savings and checking accounts from the comfort of their home. He has a vision of a system, which begins by displaying the starting balances for checking and savings account for a customer. The application first prompts the user to enter the...

  • 23. When performing the bank reconciliation, how should the company treat check 11542 A. add $800...

    23. When performing the bank reconciliation, how should the company treat check 11542 A. add $800 to the company cash account B. subtract $800 from company cash account C. add $800 to bank statement balance D. subtract $800 from bank statement balance 24. $ _The total amount needed to reconcile the company cash account was: 25. $ Chapter 4 What is the company's cash balance after the reconciliation? Page 4-3 The Company's cash ledger reports the following for the month...

  • WITHOUT FUNCTIONS. Could anyone help me solve this problem not using the function ? Thanks a...

    WITHOUT FUNCTIONS. Could anyone help me solve this problem not using the function ? Thanks a lot. Pig Dice Game Pig is a simple two player dice game, played with one die. The first player to reach or surpass 50 is the winner. Each player takes a turn rolling the dice. They add to the pot with each roll, having to decide to roll again and increase the pot, or cash out. The risk being they could lose the amount...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT