Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use Java class D extends C 14. Given the following interface: (21 pts) public interface Walletlnterface ( public double getBalance(): public void addMoney(double amount); public

image text in transcribedimage text in transcribed

use Java

class D extends C 14. Given the following interface: (21 pts) public interface Walletlnterface ( public double getBalance(): public void addMoney(double amount); public double spendMoney(double amount); public String toStringl): Write three classes named APerson, Wallet, and BankAccount. The person class should have name, iD, Wallet, and BankAcount as private members. The wallet class should have a private double amount member and implements Walletinterface The BankAcount should have the balance, account number as its private members. Write constructor, setters, getters and toString() for all three classes. In a person constructor Create Object of BankAcount with initial balance of 100.0 dollars. Create Object of Wallet as well. Provide methods (API) to help the user of you classes to do their job as follows: (see main) public class Driver 9 public static void main(String I ] args) APerson lisa new APerson ("Lisa","1111"); APerson jack new APerson("Jack", "2222"); / / check the lisa Wallet if it has no money, withdraw, 20 dollar from her bank, add to her wallet. // print the result using toString) // do the same for Jack except withdraw 40 dollar, print the result. // Write statement to see which one Lisa or Jack has more money

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

6. Is all Internet training the same? Explain.

Answered: 1 week ago