Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA// You need to code the FirstToOne game. The game is meant for two to five Player objects (should be kept in an array of

JAVA//

You need to code the FirstToOne game. The game is meant for two to five Player objects (should be kept in an array of Player), each starting with 50 points. You will be using a die. Ask the user for the number of players, the names of the players, and the number of sides on the die. Each player takes a turn rolling the die (use a random number generator to get the value). The value is subtracted from the players points. The first player to exactly one point wins! If a players remaining points minus the roll is less than one, the value is added instead of subtracted. Make certain to consider ties.

NOTE:

MUST MATCH THE UMLS

image text in transcribed
MUZT MATCH SAMPLE OUTPUT BELOW

If a tie, it needs to list it.:

image text in transcribed
image text in transcribed
SAMPLE OUTPUT: How many faces on the die? 8 How many players? 3 Name of player \#1 Mike Name of player \#2 Joe Name of player \#3 Sam Turn \#1 - Mike: 50 point(s) Roll: 7 SUBTRACTING.... New points: 43 Joe: 50 point(s) Roll: 7 SUBTRACTING.... New points: 43 Sam: 50 point(s) Roll: 3 SUBTRACTING.... New points: 47 Turn \#2 - Mike: 43 point(s) Roll: 5 SUBTRACTING.... New points: 38 Joe: 43 point(s) Roll: 6 SUBTRACTING.... New points: 37 Sam: 47 point(s) Roll: 5 SUBTRACTING.... New points: 42 Turn \#3 - Mike: 38 point(s) Roll: 1 SUBTRACTING.... New points: 37 Joe: 37 point(s) Roll: 1 SUBTRACTING.... New points: 36 Sam: 42 point(s) Roll: 3 SUBTRACTING.... New points: 39 Turn \#4 - Mike: 37 point(s) Roll: 6 SUBTRACTING.... New points: 31 Joe: 36 point(s) Roll: 8 SUBTRACTING.... New points: 28 Sam: 39 point(s) Roll: 3 SUBTRACTING.... New points: 36 Turn \#5 - Mike: 31 point(s) Roll: 3 SUBTRACTING.... New points: 28 Joe: 28 point(s) Roll: 7 SUBTRACTING.... New points: 21 Sam: 36 point(s) Roll: 1 SUBTRACTING.... New points: 35 Turn \#6 - Mike: 28 point(s) Roll: 8 SUBTRACTING.... New points: 20 Joe: 21 point(s) Roll: 2 SUBTRACTING.... New points: 19 Sam: 35 point(s) Roll: 1 SUBTRACTING.... New points: 34 Turn \#7 - Mike: 20 point(s) Roll: 6 SUBTRACTING.... New points: 14 Joe: 19 point(s) Roll: 1 SUBTRACTING.... New points: 18 Sam: 34 point(s) Roll: 3 SUBTRACTING.... New points: 31 Turn \#8- Mike: 14 point(s) Roll: 7 SUBTRACTING.... New points: 7 Joe: 18 point(s) Roll: 3 SUBTRACTING.... New points: 15 Sam: 31 point(s) Roll: 1 SUBTRACTING ... New points: 30 Turn \#9 - Mike: 7 point(s) Roll: 7 ADDING ........ New points: 14 Joe: 15 point(s) Roll: 4 SUBTRACTING... New points: 11 Sam: 30 point(s) Roll: 8 SUBTRACTING.... New points: 22 Turn \#10 - Mike: 14 point(s) Roll: 7 SUBTRACTING.... New points: 7 Joe: 11 point(s) Roll: 8 SUBTRACTING.... New points: 3 Sam: 22 point(s) Roll: 4 SUBTRACTING.... New points: 18 Turn \#11 - Mike: 7 point(s) Roll: 4 SUBTRACTING... New points: 3 Joe: 3 point(s) Roll: 4 ADDING....... New points: 7 Sam: 18 point(s) Roll: 2 SUBTRACTING.... New points: 16 Turn \#12 - Mike: 3 point(s) Roll: 6 ADDING....... New points: 9 Joe: 7 point(s) Roll: 8 ADDING....... New points: 15 Sam: 16 point(s) Roll: 8 SUBTRACTING... New points: 8 Turn \#13 - Mike: 9 point(s) Roll: 6 SUBTRACTING.... New points: 3 Joe: 15 point(s) Roll: 8 SUBTRACTING.... New points: 7 Sam: 8 point(s) Roll: 3 SUBTRACTING.... New points: 5 Turn \#14 - Mike: 3 point(s) Roll: 6 ADDING....... New points: 9 Joe: 7 point(s) Roll: 5 SUBTRACTING... New points: 2 Sam: 5 point(s) Roll: 6 ADDING........ New points: 11 Turn \#15 - Mike: 9 point(s) Roll: 8 SUBTRACTING.... New points: 1 Joe: 2 point(s) Roll: 2 ADDING....... New points: 4 Sam: 11 point(s) Roll: 7 SUBTRACTING.... New points: 4 The game was won by Mike NOTE: It a be, it needs to list it. Example: Turn \#16 - Diane: 6 point(s) Roll: 5 SUBTRACTING. New points: 1 Joe: 11 point(s) Roll: 3 SUBTRACTING. New points: 8 Miko: 4 point(s) RoE: 3 SUBTRACTING. New points: 1 The game was won by Diane and Make

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions