Answered step by step
Verified Expert Solution
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
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 moneyStep 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