/** 
    Coin class. Simplified version

    @author A. Ozgelen 
*/
public class Coin {

    public static final int HEADS = 0 ; 
    public static final int TAILS = 1 ; 
    
    public Coin(){
	this(25);
    }

    public Coin(int value) {
	this.value = value ; 
	flip(); 
    }
    
    /** randomly picks head or tail and assigns it to face value of the Coin */
    public void flip() {
	face = (int) (Math.random() * 2); 
    }
    
    /** accessor method to face
	@return 0 or 1 representing HEADS or TAILS 
    */
    public int getFace() { 
	return face; 
    }

    /** accessor method to value of the coin
	@return value of the coin in cents
    */
    public int getValue() {
	return value; 
    }

    /** mutator method to change the value of the coin
	@param value - changes the value of the coin in cents
    */
    public void setValue(int value) {
	this.value = value; 
    }

    /** overloaded toString() method */
    public String toString() {
	String face = (this.face == HEADS) ? "heads" : "tails";
	return "Coin(" + value + "cents, " + face + ")";
    }
    
    
    // data fields
    private int face ;    // head or tail 
    private int value ;   // in cents
    
} 
