Question: Write code Game.java : Ensure user to enter an integer in [1, 6] from the keyboard, that is, an integer from 1 to 6. Note
Write code Game.java:
Ensure user to enter an integer in [1, 6] from the keyboard, that is, an integer from 1 to 6. Note that if a user enters an integer other than 1, 2, 3, 4, 5, 6, your program would force the user to re-enter again.
Let computer generate a random integer in [1, 6]. Print it out.
If the user and computer generate the same integer, print out a tie; otherwise, if the users input is a multiple of the computers number, print out user wins; otherwise, if the computers number is a multiple of the users input, print out computer wins; otherwise, print out undecided
For example, 6 is a multiple of 2 since 6 can be divided by 2. Said differently, given two integers m and n, integer m is a multiple of n if the remainder of m divided by n is zero.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
