Question
Consider developing a simple bank application as per given details. The project contains different classes. One class is Account which is abstract. The Account class
Consider developing a simple bank application as per given details.
The project contains different classes. One class is Account which is abstract. The Account class should implement following details;
- List of attributes:
protected String id;
protected double balance;
- Implement the following constructor:
public Account(String id, double balance) // this constructor will be used from a sub-class's constructor.
- List of methods:
public String getID() // Returns the account id.
public double getBalance() // Returns the current balance.
publicabstractbooleanwithdraw(double amount)
publicabstract void deposit(double amount)
Second class is SavingsAccount which extends from Account. The SavingsAccount class should implement following details;
- Implement the following constructor:
publicSavingsAccount(String id, double initialDeposit): // the initial deposit passed will be at least $10.
- List of methods:
public void deposit(double amount): // The provided amount is added to the account
publicbooleanwithdraw(double amount):
Implement the withdraw method to take out the provided amount from the account balance. Incorporate the transaction fee $2 per withdrawal. A withdrawal that potentially lowers the balance below $10 is not allowed. The balance remains unchanged but the method returns false. If the withdrawal succeeds, the method returns true.
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