Using the Die class, write an application that randomly throws five dice for the computer and five

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 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.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java Programming

ISBN: 978-1337397070

9th edition

Authors: Joyce Farrell

Question Posted: