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.

RECOMMENDATION: Build the program in parts, doing one thing at a time. 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.

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

Stages of a Relationship?

Answered: 1 week ago