A Biased Coin

  1. Create a new class named BiasedCoin that models a biased coin (heads and tails are not equally likely outcomes of a flip). To do this you will modify the Coin class from the text (in the file Coin.java). To do this in BlueJ, add the Coin.java class to your project as usual. Open the file, then change "class Coin" to "class BiasedCoin" and save the file. This will create a new file, BiasedCoin.java, in your project directory/folder. Okay, now, you should alter the BiasedCoin class as follows:
  2. Create a modified version of the Runs program from the last exercise (call it BiasedRuns) that uses the BiasedCoin class. The program should prompt the user to provide an initial bias toward heads. If the user enters a value less than 0 set the bias to 0, if it is greater than 1, set the bias to 1.
  3. The hardcopy you hand in should show two executions of BiasedRuns, using different biases.