COIN GAME STARTER CODE - COPY THE CODE BELOW TO GET THE START LABEL AND TWO BUTTONS
/**
* Write a description of class CoinGameGUI here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class CoinGameGUI extends EFrame
{
// instance variables
private ELabel startText = new ELabel();
private int roundNum = 1;
public CoinGameGUI()
{ super ("Coin Game", 400, 400, true); // 4
add (startText.text("Start"));
startNewRow();
add (new TossButton().text ("TOSS")); // 5
add (new ResetButton().text ("RESET")); // 8
setVisible (true); // 9
} //======================
private class TossButton extends EButton
{ public void onClick()
{
// System.out.println("round number" + roundNum);
startText.setText("Round " + roundNum);
roundNum++; // round goes up by 1 each toss
}
} //======================
private class ResetButton extends EButton
{ public void onClick()
{
startText.setText("Start");
roundNum = 1;
}
} //======================
}