public class Prelim2Q1a {
  public static void main(String[] args) {
    
    final int heads=1, tails=0;  //the 2 faces of a coin
    int faceUp;                  //the face shown after a flip
    
    /* Flip a coin weighted such that heads occurs 3 times as often
     * as tails
     */
    if ( Math.random() < 0.25 )
      faceUp= tails;
    else
      faceUp= heads;
    System.out.println("Coin shows " + faceUp);
    
    /* Flip another coin weighted such that heads occurs 3 times as
     * often as tails
     */
    if ( Math.floor(Math.random()*4) == 0 )
      faceUp= tails;
    else
      faceUp= heads;
    System.out.println("Coin shows " + faceUp);

  }//method main

}//class Prelim1Q1a