Question
you need to make four different python files each includes the definition of one class. You first need an abstract base class, called, Account which
you need to make four different python files each includes the definition of one class.
You first need an abstract base class, called, Account which has the following attributes and methods:
accountID: This attribute holds the ID assigned the account , if not provided set to zero.
balance: This attribute holds the initial balance of the account, if not provided set to zero.
numberDeposit: This attribute holds the number of deposits this month.
numberWithdrawals This attribute holds the number of withdrawals this month.
annualInterest: This attribute holds the annual interest rate.
monthlyServiceCharges: This attribute holds the monthly service
charges of the account.
init: An init method that sets the attributes of the class.
deposit: An abstract method that accepts an argument for the amount
of the deposit. The method should add the argument to the account balance. It should also increment the variable holding the number of deposits.
withdraw: An abstract method that accepts an argument for the amount of withdrawal. This methods should subtract the argument from the balance. It should also increment the variable holding the number of withdrawals.
calcInterest: An abstract method that updates the balance by calculating the monthly interest earned by the account, and adding this interest to the balance. This is performed by the following formulas:
o Monthly Interest Rate = Annual Interest Rate / 12 o Monthly Interest = Balance * Monthly Interest Rate o Balance = Balance + Monthly Interest
2
monthlyProc: An abstract method that subtracts the monthly service charges from the balance, calls the calcInteret method, then sets the variables that hold the number of withdrawals, number of deposits, and monthly service charges to zero.
str: Through this method, account ID and balance are displayed.
Next, design a savings account class, called SavingsAccount, derived from the generic Account class. The SavingsAccount class should have the following additional members:
status: This attribute represent if account is active or inactive.
If the balance of the savings account falls below $3, it becomes inactive (the status member could be a flag variable). No more withdrawal would be made until the balance is raised above $30, at which time the account becomes active again. The savings account class should have the following methods:
init: An init method that inherits from the init method of Account class and also sets the status attribute of the class.
deposit: A method that checks if the account is inactive before a deposit is made. If the account is inactive the deposit brings the balance above $30, the account becomes active again. The deposit is then made by calling the base class version of the method.
withdraw: A method that checks to see if the account is inactive before a withdrawal is made. No withdrawal is made if the account is inactive. A withdrawals is then made by calling the base class version of the method.
monthlyProc: Before the base class method is called, this method checks the number of withdrawal. If the number of withdrawals for the month is more than 4, then a service charge of $2 for each withdrawals above 4 is added to the base class variable that holds
3
the monthly service charges. Dont forget to check the account balance after the service charges are taken. If the balance falls below $30, the account becomes inactive.
str: This method prints the account ID, balance, and status. Next, design a checking account class, also derived from the generic
Account class. It should have the following member functions:
withdraw: Before the base class method is called, this method will determine if withdrawal will cause the balance falls below $0. If the balance goes below $0, a service charge of $20 will be taken from the account and no withdrawal would be made. If there is not enough to pay the account charges, the balance will become negative and the customer will owe the negative amount to the bank.
monthlyProc: Before the base class method is called, this function adds the monthly fee of $5 per withdrawals to the base class variable that holds the monthly service charges.
In the Main.py file, write a complete main function that demonstrates these classes by asking the user to enter the accounts of deposits and withdrawals for a savings and checking account. The program should display statistics for the month, including the beginning balance, total amount of deposits, total amount of withdrawals, service charges and ending balance.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started