Question: What is the output of the driver code? public class Gambler { private int money; public Gambler ( int m ) { money = m;
What is the output of the driver code?
public class Gambler
private int money;
public Gamblerint m money m;
public int currentMoney return money;
public void addMoneyint m money m;
public void work money ;
public void play money ;
public void liveAnotherDay work; play;
public String toString return money;
end of class Gambler
public class CompulsiveGambler extends Gambler
public CompulsiveGamblerint m superm;
public void work do nothing
public void play
while currentMoney
super.play;
end of play
end of class CompulsiveGambler
in client code
Gambler x new CompulsiveGambler;
xliveAnotherDay;
System.out.printlnx;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
