Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Java, create a program that allows SIX players (identified as player 1 through player 6) to play a dice game as follows. Each round,

Using Java, create a program that allows SIX players (identified as player 1 through player 6) to play a dice game as follows. Each round, each player rolls a 20-sided die, simulated by generating a random number between 1 and 20. The value they roll is then added to their current total, which starts at 0 initially. At the end of the round, any player with a score OVER 100 is eliminated from the game. Keep on playing the game until only one player remains, the winner. If all remaining players are eliminated in a particular round, then no one is the winner.

Player scores should be shown at the end of each round. At the end, print the winner, and how many rounds the game went.

As usual, please turn in your source code and a hardcopy of your test results. Also, please email me a copy of your code so I can run it if needed.

RECOMMENDATION: Build the program in parts, doing one thing at a time, as we had discussed in class, and as I showed on the board. Then, once one part is working, add on to it with the next part, and so on. That way, you have some components working in case you canot get it all working. It is also a good way to learn how to break down a problem into parts first.

Some ideas on separate parts:

- Create an arraylist of for the 6 players, with each element at 0

- Print the arraylist

- Randomly roll a number from 1-20 for all 6 players ONCE

- Put it into a loop

- Check each player for being over 100

etc ...


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

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

List the principal contents of an Engagement Letter.

Answered: 1 week ago