// Button.java: a class representing a button object 
public class Button{ 
    // the state of the button
    // myState == true means the button is pushed
    // myState == false means the button is cleared (not pushed)
    private boolean myState; 

    // constructor -- used when a new button is created (starts cleared)
    public Button(){ 
         myState = false;
    } 

    // accessor -- used to fetch the button's state
    public boolean getState(){
         return myState;
    }
 
    // used to print the button's state
    public void tellState(){
         System.out.println("  From tellState: I am in state " + myState);
    }
 
    // used to automatically print the button's state
    public String toString(){
         return "  From toString: I am in state " + myState;
    }
 
    // modifier -- used to "push" the button
    public void pushButton(){
         myState = true;
    }
 
    // modifier -- used to "clear" the button
    public void clearButton(){
         myState = false;
    } 
} 

