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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!