Question: I treid doing this, but im getting error. The error is saying that I need to create a method, but I already did it. Here's
I treid doing this, but im getting error. The error is saying that I need to create a method, but I already did it.

Here's my code:
public class ATM { private int cash; boolean inService;
ATM(){ cash = 0; inService = false; }
ATM(int x, boolean y){ cash = x; inService = y; }
public int queryCash(){ return cash; }
public void increaseCash(int x) { this.cash = cash + x; }
public void reduceCash(int x) { this.cash = cash - x; } boolean getServiceStatus() { return inService; }
public void changeServiceStatus() { inService = !inService; System.out.println(inService); } class CashDispenser { public void dispenseCash(int x) { ATM a = new ATM(); int result = a.reduceCash(x) System.out.println( " as been dispensed"); } } }
3. In the ATM class in the same file, create the following member classes (i.e. nested classes): a. class CashDispenser no data members only one member method: void dispenseCash(int x) this method calls the ATM's reduceCash() method to reduce the ATM's cash by x and then prints "X dollars has been dispensed" to the screen
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
