Question: Using the Die class, write an application that randomly throws five dice for the computer and five dice for the player. Display the values and

Using the Die class, write an application that randomly “throws” five dice for the computer and five dice for the player. Display the values and then, by observing the results, decide who wins based on the following hierarchy of Die values. (The computer will not decide the winner; the player will determine the winner based on observation.) Any higher combination beats a lower one; for example, five of a kind beats four of a kind.

  • Five of a kind
  • Four of a kind
  • Three of a kind
  • A pair

After you learn about decision making in Chapter 5, you will be able to make the program determine whether you or the computer had the better roll, and after you read the chapter “Introduction to Arrays,” you will be able to make the determination more efficient. For now, just observe how the values change as you execute the program multiple times. Save the application as FiveDice.java.

Step by Step Solution

3.42 Rating (174 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

FiveDicejava public class FiveDice public static void ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!