Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

undefined Design an abstract class called BankAccount which stores the balance. -Implement a constructor that takes the balance (float). -Provide abstract methods deposit(amount) and withdraw(amount)

undefinedimage text in transcribedimage text in transcribedimage text in transcribed

Design an abstract class called BankAccount which stores the balance. -Implement a constructor that takes the balance (float). -Provide abstract methods deposit(amount) and withdraw(amount) Design a class called Savings Account which extends BankAccount. - Implement a constructor that takes the balance as input. - It should store a boolean flag active. If the balance at any point falls below $25, it sets the active flag to false. It should NOT allow the balance to fall below So. -If the active flag is false, no more withdraws can be made until deposits are made to bring the account back up to $25. An error message should be printed when withdraws fail. -Implement the deposit and withdraw methods. They should print at the end the amount deposited/withdrew and the new balance. Write a main method that asks the user for the starting balance and creates a Savings Account object. It asks the user whether they want to deposit or withdraw until they choose to exit. Sample Input 0 100 W 50 w 30 W 20 W 10 D 50 W 10 E Enter starting balance: Choose an option: D: Deposit W:Withdraw E:Exit Enter amount: Withdrew $50.00, new balance: $50.00 Choose an option: D: Deposit W:Withdraw E:Exit Enter amount: Withdrew $30.00, new balance: $20.00 Choose an option: D: Deposit W:Withdraw E:Exit Enter amount: Cannot withdraw $20.00! Choose an option: D: Deposit W:Withdraw E:Exit Enter amount: Cannot withdraw $10.00! Choose an option: D: Deposit W:Withdraw E:Exit Enter amount: Deposited $50.00, new balance: $70.00 Choose an option: D: Deposit W:Withdraw E:Exit Enter amount: Withdrew $10.00, new balance: $60.00 Choose an option: D: Deposit W:Withdraw E:Exit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Step: 3

blur-text-image

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

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago