Question: Instructions 1 . Abstract Class - BankAccount - Fields: accountNumber, balance . - Constructor: Initializes accountNumber and - Abstract Methods: - void deposit ( double
Instructions
Abstract Class BankAccount
Fields: accountNumber, balance
Constructor: Initializes accountNumber and
Abstract Methods:
void depositdouble amount : Adds to the balance.
void withdrawdouble amount : Deducts from the balance if there are sufficient funds.
Concrete Method:
double getBalance: Returns the current balance.
Derived Classes
SavingsAccount:
Field: interestRate.
Method applyInterest : Adds interest to the balance.
Overrides the deposit and withdraw methods based on specific rules eg minimum balance
CheckingAccount:
Field: overdraftLimit.
Overrides withdraw to allow overdrafts up to a limit
Main Class
Create a main class to:
Instantiate both
and
Perform deposit and withdraw operations.
Display the account balance.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
