Question
PHP LANGUAGE: Write a web application names numbers. In this application, the program will pick a random number between 1 and 50. The user will
PHP LANGUAGE:
Write a web application names numbers. In this application, the program will pick a random number between 1 and 50. The user will have 5 chances to guess what that number is. When first loaded, the game should present the user with a brief explanation of the rules and a simple form into which the user can enter their guess.
Each time a guess is entered, the program should provide the user with feedback as follows:
If the guess is not an integer in the range 1 to 50, redisplay the guess form with a message indicating the problem and ask the user to try again.
If the guess is correct, notify the user of their win and provide them with a link that they can use to play again.
If the guess is incorrect, inform the user whether their guess is too high or too low and how close they are as follows:
o If their guess is within 5 of the correct answer, let the user know they are "Super Close;
o If their guess is within 10 of the correct answer, let the user know they are Close;
o If their guess is within 15 of the correct answer, let the user know they are Far; and
o In all other cases, let the user know they are Super Far;
If the user has no chances remaining, thank them for playing and provide them with a link they can use to play again. Otherwise, present them with a page that tells them how many chances they have left and provides a form into which they can enter their next guess.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started