Suppose you have been hired to develop a musical chair game. In this game there will be 7 participants and all of them will be moving clockwise around a set of 7 chairs organized in a circular manner while a music will be played in the background. You will control the music using random numbers between 0-3.If the generated random number is 1, you will stop the music and if the number of participants who are still in the game is n, the participant at position (n/2) will be eliminated. Each time a participant is eliminated, a chair will be removed and you have to print the player names who are still in the game. The game will end when there will be only one participant left. At the end of the game, display the name of the winner. Please answer it in Java code.
Suppose you have been hired to develop a musical chair game. In this game there will be
7 participants and all of them will be moving clockwise around a set of 7 chairs organized
in a circular manner while a music will be played in the background. You will control the
music using random numbers between 0-3.If the generated random number is 1, you will
stop the music and if the number of participants who are still in the game is n, the
participant at position (n/2) will be eliminated. Each time a participant is eliminated, a
chair will be removed and you have to print the player names who are still in the game.
The game will end when there will be only one participant left. At the end of the game,
display the name of the winner.
Please answer it in Java code.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images