For your first program, you are to write a simple Dodgeball simulation. In this simulation, we will have n players, and one ball. One player, the "thrower," will have the ball. The thrower will throw the ball at another player, the "target." The target could catch the ball, could be hit by the ball, or the ball could completely miss the target. If the target catches the ball, then the thrower is out of the game (and the target becomes the next thrower.) If the ball hits the target, then the target is out of the game. If the ball misses the target, neither player is out. In the latter two cases, any one can pick up the ball and become the next thrower. The game is over when only one player is left. In this simple version, the players (initially n players) will stand in a circle. The thrower will always count the players to his/her right, and then throw the ball at the dth player, who becomes the target. The target will always catch the ball, so that the thrower will be out of the game (and will leave the circle.) The other players remain at their positions in the circle. The new thrower then counts the players to his/her right, and throws the ball to the dth person, who catches it. The game continues until one player is left. Note that when the thrower counts to the dth player, the thrower may have to go around the circle (possibly more than once) and never counts himself/herself, to get to d. For example, if n is 3, that is, there are 3 players (say 1, 2, and 3) left, d is 5, and player 1 is the thrower, then player 1 will count the players 2, 3, 2, 3, 2 to get to 5, and then throw the ball at player 2. If there are only two players left, the thrower will always throw the ball at the other player. Program specifications The program will prompt the user to type in the number of players and then read in n. The program will prompt the user to type in the number of players to count to find the target, and then read in d. Input should be read from standard input (System.in). The initial players are numbered from 1 to n and form a circle. Player 1 is always the first thrower. The program will then simulate each round of the game. The program will print out the players at the start of the game and print out the players remaining after each turn. The circle of players should be printed out all on one line, the the assumption being that the first person follows the last person in the circle. The thrower should be indicated by an asterisk. The game stops when only one player is left. Output should be printed to standard output (System.out). For this assignment, you must use arrays not arraylists

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

For your first program, you are to write a simple Dodgeball simulation. In this simulation, we will have n
players, and one ball. One player, the "thrower," will have the ball. The thrower will throw the ball at another
player, the "target." The target could catch the ball, could be hit by the ball, or the ball could completely miss
the target. If the target catches the ball, then the thrower is out of the game (and the target becomes the next
thrower.) If the ball hits the target, then the target is out of the game. If the ball misses the target, neither
player is out. In the latter two cases, any one can pick up the ball and become the next thrower. The game is
over when only one player is left.
In this simple version, the players (initially n players) will stand in a circle. The thrower will always count
the players to his/her right, and then throw the ball at the dth player, who becomes the target. The target will
always catch the ball, so that the thrower will be out of the game (and will leave the circle.) The other players
remain at their positions in the circle. The new thrower then counts the players to his/her right, and throws
the ball to the dth person, who catches it. The game continues until one player is left. Note that when the
thrower counts to the dth player, the thrower may have to go around the circle (possibly more than once) and
never counts himself/herself, to get to d. For example, if n is 3, that is, there are 3 players (say 1, 2, and 3)
left, d is 5, and player 1 is the thrower, then player 1 will count the players 2, 3, 2, 3, 2 to get to 5, and then
throw the ball at player 2. If there are only two players left, the thrower will always throw the ball at the other
player.
Program specifications
The program will prompt the user to type in the number of players and then read in n. The program will
prompt the user to type in the number of players to count to find the target, and then read in d. Input should
be read from standard input (System.in). The initial players are numbered from 1 to n and form a circle.
Player 1 is always the first thrower. The program will then simulate each round of the game. The program
will print out the players at the start of the game and print out the players remaining after each turn. The
circle of players should be printed out all on one line, the the assumption being that the first person follows
the last person in the circle. The thrower should be indicated by an asterisk. The game stops when only one
player is left. Output should be printed to standard output (System.out). For this assignment, you must use arrays not arraylists

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education