Question

JAVASCRIPT HOMEWORK PLEASE HELP! ask the user to input their temperature. Use this information to determine...

JAVASCRIPT HOMEWORK PLEASE HELP!

ask the user to input their temperature.

Use this information to determine if the person has a fever (above 98.6), hypothermia (below 95), or a normal temperature (98.6)

If the user’s temperature is normal congratulate them on their health and end the program.

If not, give the user advice on how to treat their condition.

Continue checking the user’s temperature until they feel better.

Find out if the user feels better. If so, end the program. If not, ask them to take their temperature again and repeat the process until they do.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear Student ,

As per requirement submitted above kindly find below solution.

Here new web page with name "temperature.html" is created which contains below code.

temperature.html :

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <!-- title for web page -->

    <title>Temperature checking</title>

</head>

<body>

    <!-- <script> is used for javascript -->

    <script>

        var flag = true;//variable used for flag

        while (flag) {

            //asking user temperature

            var temp = parseFloat(prompt("Enter temperature", "temperature"));

            //checking temperature

            if (temp > 98.6) {

                //if temperature is greater then 98.6 then alert user

                alert(temp + " means you have a fever");

            }

            else if (temp >= 95 && temp <= 98.6) {

                //if temperature is normal

                //when temperature is greater than or equal to 95

                //and less than or equal to 98.6

                alert("Congratulation you have " + temp + " temperature means its normal");

                flag = false;//set the flag

            }

            else if (temp < 95) {

                //if temperature is less than 95 then

                alert(temp + " temperature means you have " + hypothermia);

            }

        }

    </script>

</body>

</html>

==================================

Output :Open web page temperature.html in the browser and will get the screen as shown below.

Screen 1:Screen asking user temperature

Screen 2:Screen showing health report

Screen 3:

NOTE :PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Add a comment
Know the answer?
Add Answer to:
JAVASCRIPT HOMEWORK PLEASE HELP! ask the user to input their temperature. Use this information to determine...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT