|
HWJ8_Random
You are going to create a class called HWJ8_Random that will either
flip a coin, roll a dice, or receive a card.
Everybody do 3, advanced do all. Really advanced do extension.:
- a method called flipCoin that will flip a coin, System.out.println
the results, AND return a boolean (true for heads, false for tails)
- a method called rollDice that will roll one die, System.out.println
the results, AND return the number rolled.
- a method called roll2Dice that will roll 2 dice, System.out.println
the results of each die, AND return an int with the sum of the
outcome (2-12). I want you to call rollDice in this method.
- method called dealCard that will choose a random card, System.out.println
the results, AND return a String with the outcome (ie 6 of hearts)
5 POINTS DUE Tomorrow
-
Extension - For advanced
- a new method that says analyzeRolls that will take in an
int and roll the die that many times, at the end, it is to
say how many 1,2,3,4,5,6 were rolled and percentages of each
- a new method that says analyze2Rolls that will take in an
int and roll the die that many times, at the end, it is to
say how many 2-12 were rolled and percentages of each
|