Write a java program, This program should play a game of dice: you against the computer... (well, actually it's computer vs computer, but the first computer rolls for you), You are given a method roll() that returns a random integer between 1 and 6 Use it to play a game: - first "you" roll two dice and report the outcome, - then the computer rolls two dice and reports. - Finally, the program compares two sums and declares the winner. - In case of a tie, you win (not fair for the computer, but life's not fair) The output should look similar
Write a java program, This program should play a game of dice: you against the computer... (well, actually it's computer vs computer, but the first computer rolls for you), You are given a method roll() that returns a random integer between 1 and 6 Use it to play a game: - first "you" roll two dice and report the outcome, - then the computer rolls two dice and reports. - Finally, the program compares two sums and declares the winner. - In case of a tie, you win (not fair for the computer, but life's not fair) The output should look similar to this: ======== You roll 6 and 6. Sum = 12 Computer rolls 1 and 4. Sum = 5 12 is greater than or equal to 5. You win :( ======== or ======== You roll 3 and 6. Sum = 9 Computer rolls 6 and 4. Sum = 10 9 is less than 10. Computer wins!!! ======== Implement the unfinished steps indicated by ...
Step by step
Solved in 4 steps with 2 images