Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Please Do Not Any other language ONLY JavaScript and HTML, CCS, Create the webpage (Higher-Lower game) usin g HTML, CCS, and JavaScript. Here are

Please Please Do Not Any other language

ONLY JavaScript and HTML, CCS,

Create the webpage (Higher-Lower game) using HTML, CCS, and JavaScript. Here are the details of the instructions.

Prompt for Max Number

Use the EnterInput() method to ask the user what the maximum number should be. The prompt should be in a loop with validation making sure that the input is a positive integer. If the inputs is a decimal or negative number, simply round it.

When a valid value is entered, ask the user to specify guesses between 1 and N.

Make sure that :

  • The application prompts for a maximum number and uses it in the logic appropriately.
  • The application additionally validates the user input and does not allow invalid entries (negative numbers, 0, or non-numbers), re-prompting the user if an invalid entry is entered.

2. Validate the Guess

When the user presses the guess button, validate the input:

  • If the guess is not a number, display a message: "Wrong guess"
  • If the guess is out of range (1 to N), display a message: "That number is not in range, try again."

Make sure that:

  • The application prevents invalid entries (not a number, out of range).
  • The application provides appropriate error messages for each type of invalid entry.

3. Track the Guesses

Using an array, keep track of each guess by the user. When the user wins the game by guessing correctly, add the number of guesses and the list of guesses to the victory message. For example:

"You got it! It took you 5 tries and your guesses were 3, 14, 7, 9, 5"

Do not count invalid guesses (not numbers or out of range).

Make Sure that:

  • The application correctly initializes an array and uses the push() function to add the guesses.
  • The application stores the number of tries either in a variable or uses the length property.
  • The application correctly formats the win message to include the comma-delimited guesses as part of the output.
  • The application uses the length property and does not use an extra variable to count the number of guesses.

4. Prevent Duplicate Guesses

Since you are tracking the guesses, add validation to check if a number has already been guessed. If it has, display a message and do not count it as a guess.

Make sure that :

  • The application correctly checks the array for a guess first using any means (loop, find(), etc.).
  • The application correctly displays the validation message.

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

Students also viewed these Databases questions

Question

Why is each of the four steps in the delegation process necessary?

Answered: 1 week ago