Question: In Java, HOR SNCE Preamble Skee-Ball is a popular classic redemption arcade game. The aim of the game is to roll a ball up an

In Java,

In Java, HOR SNCE Preamble Skee-Ball is a popular classic redemption arcadegame. The aim of the game is to roll a ball upan inclined lane and over a hump that jumps the ball into

HOR SNCE Preamble Skee-Ball is a popular classic redemption arcade game. The aim of the game is to roll a ball up an inclined lane and over a hump that jumps the ball into one of the bullseye rings. The objective of the game is to collect as many points as possible by having the ball fall into holes in the rings which have progressively increasing point values. The full description is available on Wikipedia (https://en.wikipedia.org/wiki/Skee-Ball) In this assignment, you will write a Java program that simulates the game of Skee-Ball. The assignment consists of a single Java class as described below. Additionally, you must use each of the following structures at least once in your code: Figure 11 1. WHILE (or Do... While) loop 2. FOR loop 3. SWITCH structure 4. Static and final class member called MAX_PLAYS with a value of 8 5. Two non-static methods as described below. You may add additional non-static methods if you think your implementation can benefit from them. Your program should NOT contain any static methods besides main(). Game flow: 1. Prompt the user to enter the number of plays. Ensure that the number entered is between 1 and MAX_PLAYS (inclusive). If the number entered is outside of the two limits, display an error message and prompt the user again. See Figure 2. 2. After the user enters a valid input, invoke the method simulatePlay() 3. Finally, invoke the method displayStats(). The program should terminate afterwards. Required Methods: I. main(): The only static method in the program and contains the game's flow described earlier. Remember that static method can only invoke non-static ones through an instance of a class. II. simulate Play(): Non-static Add parameters if needed Using Javas random number generator class, generate a random number to simulate the throw of the ball. Assign the play a value based on the percentages shown in Table 1 (See the hint below the table.). You may, also, choose to create a separate method to return the hall value. This improves the code's manageability and readability. The method repeats the play simulation several times equal to the value entered by the user in main() After each play iteration, print a message which shows the play number and the points assigned (Figure 3). III. displayStats(): Non-static Add parameters needed Displays the results of the simulated plays along with the total points. See Figure 3 and Figure 4 Note that this method's output is different from that of simulatePlay(). This is simply a summary of all the simulated plays. Hint: printf() simplifies printing here. Figures: Enter the number of plays (1-8)? O ) Invalid input. Please enter a number between 1 and 8. Enter the number of plays (1-8)? -1 Invalid input. Please enter a number between 1 and 8. Enter the number of plays (1-8)? 100 Invalid input. Please enter a number between 1 and 8. Enter the number of plays (1-8)? Figure 2: Invalid entry message and re-prompt Enter the number of plays (1-8)? 5 Rolling ball #1. Landed in a Rolling ball #2. Landed in 10 Rolling ball #3. Landed in 20 Rolling ball #4. Landed in 80 Rolling ball #5. Landed in 40 Play # Score 1 2 10 3 4 5 20 80 40 Total: 150 Figure 3: Sample simulation using 5 plays (number will vary due to the random number generator) Enter the number of plays (1-8)? 8 Rolling ball #1. Landed in 40 Rolling ball #2. Landed in 10 Rolling ball #3. Landed in 10 Rolling ball #4. Landed in 10 Rolling ball #5. Landed in 10 Rolling ball #6. Landed in a Rolling ball #7. Landed in 10 Rolling ball #8. Landed in 20 Play # Score 1 40 2 3 10 10 10 4 5 10 6 7 8 10 20 Total: 110 Figure 4: Sample simulation using & plays (number will vary due to the random number generator)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!