Question: 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
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
Get step-by-step solutions from verified subject matter experts
