Write a complete Java program which will simulate the playing of a game of dice. The program will do the following: 1. The main method will ask the user to type in two integer values, each in the range from 1 to 6, into variables called diel and die2. Use a boolean method valid to determine whether a die is valid or not. Bad data is to be rejected (except for the special combination you use to end the set of data). For example, if someone types in 3 and -2, the combination is to be rejected. The main method will print the numbers as soon as they are read in. 2. The main method will send these two integer values to a method named outcome. The method will determine the outcome of using these two numbers, according to this scheme: a. If the numbers add up to 5, 7, or 12, then the player wins, and the method should return an indication of this (use some integer to represent a win). b. If the numbers add up to 2, 4, or 11, then the player loses, and the method should return an indication of this (once again, use an integer). c. If the numbers add up to anything else, then the game is a draw and the method should say this (by way of an integer). 5. Finally, the main method will continue wit user types in a special combination (you mu must explain it to the person using Data: 3 2 31 34 36 51 56 55 52 :
Write a complete Java program which will simulate the playing of a game of dice. The program will do the following: 1. The main method will ask the user to type in two integer values, each in the range from 1 to 6, into variables called diel and die2. Use a boolean method valid to determine whether a die is valid or not. Bad data is to be rejected (except for the special combination you use to end the set of data). For example, if someone types in 3 and -2, the combination is to be rejected. The main method will print the numbers as soon as they are read in. 2. The main method will send these two integer values to a method named outcome. The method will determine the outcome of using these two numbers, according to this scheme: a. If the numbers add up to 5, 7, or 12, then the player wins, and the method should return an indication of this (use some integer to represent a win). b. If the numbers add up to 2, 4, or 11, then the player loses, and the method should return an indication of this (once again, use an integer). c. If the numbers add up to anything else, then the game is a draw and the method should say this (by way of an integer). 5. Finally, the main method will continue wit user types in a special combination (you mu must explain it to the person using Data: 3 2 31 34 36 51 56 55 52 :
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
088..
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 4 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY