HTML Assignment Help Online
Please follow the instructions carefully and complete all of the steps.
- An HTML file with the name midterm1.html already exists in the Midterm1_Part2 folder you downloaded. It contains all the tags you would need to complete this exam. The document looks as follows
A. [10 marks]
- a) Create a global variable called lotto that is initialized to 0.
- b) When the Generate Number button is pressed, a function generate lotto() should generate a random 2-digit number and store it in the global variable lotto.
- c) When the Check My Numbers button is pressed, a function compare numbers() should run to see how closely the number entered by the user matches the randomly generated lottery number. The user is a winner in the following three scenarios:
- If the user input matches the lotto number in the exact order, the award is $10,000.
- If both digits in the user input match both digits in the lottery number, but out of order, the award is $3,000.
- If one digit in the user input matches a digit in the lottery number, the award is $1,000.
- d) If the number doesn’t match the lottery number at all, there is no award for the user.
B. [10 marks]
- a) The user enters his/her weight and height in the provided boxes. The weight should be entered in lbs and converted into kg by multiplying with 0.45359237. Similarly, the height is entered in inches and converted into meters by multiplying with 0.0254.
- b) The formula for calculating the BMI is:
- ð¤ð¤ð¤ð¤ð¤ð¤ð¤ð¤âð¡ð¡ð¡ð¡ð¡ð¡ð¡ð¡ð¡ ð¡ð¡ð¡ð¡ð¡ ð¡ð¡ð¡ð¡ð¡ð¡ð¡ð¡ / âð ð âð¡ð¡ð¡ð¡ð¡ð¡ð¡ð¡ð¡ ð¡ð¡ð¡ ð¡ð¡ð¡ð¡2
- c) The rules for categorizing a person as “Underweight”, “Normal”, “Overweight”, or “Obese” are as follows:
- if the BMI is less than 18.5, the person is “Underweight”
- if the BMI is greater than or equal to 18.5 but less than 25, the person is “Normal”
- if the BMI is greater than or equal to 25 but less than 30, the person is “Overweight”
- if the BMI is greater than or equal to 30, the person is “Obese”
- d) The BMI should be displayed with 2 digits of precision after the decimal point. For
- For example, if the calculated BMI is 34.31424464, it should display as 34.31.
Some sample runs of the application are shown below: