Design and implement the following 3 classes with the exact fields and methods (these names and caps exactly):
1. An abstract class named BankAccount (java file called BankAccount.java):
Balance A field for the bank account balance
NumberDeposits A field for the number of deposits this month
NumberWithdrawals A field for the number of withdrawals this month
AnnualInterestRate A field for the annual interest rate
MonthlyServiceCharge A field for the monthly service charge
BankAccount A constructor method that accepts as arguments the balance and the annual interest rate
SetMonthlyServiceCharges A method that accepts the monthly service charges as an argument and set the field value
GetBalance A method that returns the bank account balance
GetNumberDeposits A method that returns the number of deposits this month
GetNumberWithdrawals A method that returns the number of withdrawals this month
GetAnnualInterestRate A method that returns the annual interest rate
GetMonthlyServiceCharge A method that returns the monthly service charge
Deposit A method that accepts the amount of the deposit as an argument, add the value of that argument to the account balance, and increment the variable holding the number of deposits.
Withdrawal A method that accepts the amount of the withdrawal as an argument, subtracts that argument value from the balance, and increment the value holding the number of withdrawals.
CalculateInterest A method that updates the balance by calculating the monthly interest earned by the account (MonthlyInterest = Balance * (AnnualInterestRate / 12), and adding this interest to the balance ( Balance = Balance + MonthlyInterest)
MonthlyProcess A method that subtracts the monthly service charges from the balance, callas the CalculateInterest method to calculate the interest, and then sets to 0 the variables for NumberDeposits, NumberWithdrawals, and MonthlyServiceCharge.
2. A class named SavingsAccount (java file called SavingsAccount.java) that extends the BankAccount class.
Status A private (Boolean) field that holds the account status: if it is active or inactive. If the balance of the account falls below $25, the account becomes inactive. No withdrawals can be made from an inactive account.
SavingsAccount A constructor method that accepts as arguments the account balance, the annual interest rate, and the monthly service charge. The constructor should call the superclass constructor and, based on the account balance, the constructor should set the account Status to true or false.
Deposit A method that accepts the deposit amount as an argument, calls the superclass version of the Deposit method to make a deposit, and then updates the Status of the accounts if the balance goes above $25.
Withdrawal A method that accepts the withdrawal amount as an argument, checks if the status of the account is active, and, if that is true, calls the superclass version of the Withdrawal method, to make a withdrawal from the account. The method should update the Status if the balance goes under $25.
MonthlyProcess A method that does the monthly process based on the number of withdrawals from the account: If the number of withdrawals for the month is less or equal to 4, the method calls the superclass version of the MonthlyProcess method, to do the monthly process. If the number of withdrawals for the month is more than 4, then a service charge of $1 for each withdrawal above 4 (e.g. $1 for 5, $2 for 6, etc.) is added to the superclass field that holds the monthly service charge (using the superclass SetMonthlyServiceCharges ). Then, the method calls the superclass version of the MonthlyProcess method, to do the monthly process.
3. A driver class/program/project called [YourName]Assignment3 (java file called [YourName]Assignment3.java , replace [YourName] with your actual name) in the same project as the BankAccount.java and SavingsAccount.java that create one or more SavingsAccount objects and demonstrate the methods GetBalance , GetNumberDeposits , GetNumberWithdrawals , GetAnnualInterestRate , GetMonthlyServiceCharge , Deposit , Withdrawal , CalculateInterest , and MonthlyProcess for that particular SavingsAccount object.
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.