Question: //////////////////////////////////////////////////////////////////////////////////////////////////////////////IN JAVA///////////////////////////////////////////////////////////////////////////////////////////////////////// Create a public driver class called PlayLadderAndSnake. In the main() method, you need to prompt the user to enter the number of players

//////////////////////////////////////////////////////////////////////////////////////////////////////////////IN JAVA/////////////////////////////////////////////////////////////////////////////////////////////////////////

Create a public driver class called PlayLadderAndSnake. In the main() method, you need to prompt the user to enter the number of players that he/she needs to play the game with. The user must enter a value between 2 and 4. If the user does not enter a correct value, the program must prompt the user again to enter a correct value. However, there is a limit of 4 total attempts. If the user enters an incorrect value 4 times, then the program must display a message to this effect and terminates. For instance, the program behaviour may look something similar to the following:

Enter the # of players for your game Number must be between 2 and 4 inclusively:

6 Bad Attempt 1 - Invalid # of players. Please enter a # between 2 and 4 inclusively:

8 Bad Attempt 2 - Invalid # of players. Please enter a # between 2 and 4 inclusively:

i. 5 Bad Attempt 3 - Invalid # of players. Please enter a # between 2 and 4 inclusively. This is your last attempt:

10 Bad Attempt 4! You have exhausted all your chances. Program will terminate!

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!