Question: For this exercise, you will need to create a class named Account, this class represents a bank account This class has a constructor that sets

For this exercise, you will need to create a class named Account, this class represents a bank account This class has a constructor that sets the variable balance to 0. It also has two methods: deposit that takes a double and add that number to the balance, and withdraw that takes a double and removes that amount from the balance, both method should print the new balance. However, if the amount to withdraw is higher than the balance, you need to throw the NotEnoughMoneyException. You will need to create the NotEnoughMoneyException, it extends lllegalStateException. It has a method getAmount that returns the amount that was requested. getBalance that returns the balance at the time the exception was created and getMissingAmount that returns the amount of money needed to withdraw the requested amount. The exception should also invoke it's super constructor so that the method getMessage indicates that the amount cannot be withdrawn. When running the code you should get an output similar to this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
