Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//////////////////////////////////////////////////////////////////////////////////////////////////////////////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

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions