RollLoadedDie.java


Below is the syntax highlighted version of RollLoadedDie.java.


/*************************************************************************
 *  Name:
 *  Login:
 *  Precept:
 *
 *  Compilation:  javac RollLoadedDie.java
 *  Execution:    java RollLoadedDie
 *
 *  Simulate the roll of a loaded six-sided die, where the values
 *  1, 2, 3, 4, and 5 appear with probability 1/8 and the value 6
 *  appears with probablity 3/8, and print the resulting number.
 *
 *  % java RollLoadedDie
 *  4
 *
 *  % java RollLoadedDie
 *  6
 *
 *************************************************************************/

public class RollLoadedDie {
   public static void main(String[] args) {
      // generate random double in the range [0.0, 1.0)
      _________________ r = __________________________________________;
 
      // compute the roll with desired probabilities
      int roll;
      if      (________________________________________) roll = _______;
      else if (
      else if (
      else if (
      else if (
      else    

      // print the roll


   }
}