Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

publicabstractboolean withdraw(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

publicboolean withdraw(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.


SOLVE THIS IN JAVA PROGRAMMUNG LANGUAGE.

Step by Step Solution

3.49 Rating (146 Votes )

There are 3 Steps involved in it

Step: 1

Accountjava abstract public class Account protected String id protected double balance public Accoun... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals of Engineering Economics

Authors: Chan S. Park

3rd edition

132775425, 132775427, 978-0132775427

More Books

Students also viewed these Programming questions