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
  • Write a JAVASCRIPT program that will help an elementary school student learn multiplication. Use the Random...

    Write a JAVASCRIPT program that will help an elementary school student learn multiplication. Use the Random method to produce two positive one-digit integers. The program should then prompt the user with a question using random numbers, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer. If it is correct, display the message "Very good!" and ask whether the student wants to continue if so then ask another multiplication...

  • In C++ program Fishing Game Simulation   For this assignment, you will write a program that simulates a fishing game. In this game, a six-sided die is rolled to determine what the user has caught. Eac...

    In C++ program Fishing Game Simulation   For this assignment, you will write a program that simulates a fishing game. In this game, a six-sided die is rolled to determine what the user has caught. Each possible item is worth a certain number of fishing points. The points will not be displayed until the user has finished fishing, and then a message is displayed congratulating the user depending on the number of fishing points gained.   Here are some suggestions for the...

  • Java programming for ticket price calculator.  It should ask the user if they would like to process...

    Java programming for ticket price calculator.  It should ask the user if they would like to process another ticket order. They should indicate their selection with a Y or N. If they indicate yes, then it should repeat the entire program with the exception of the welcome screen. If they indicate no, it should show the final thank you message and end the program. If they indicate an invalid answer, it should display an error and re-prompt them for a Y...

  • MATLAB HOMEWORK QUESTION DUE TOMORROW: PLEASE HELP!!! The viscosity of blood depends on many factors (temperature,...

    MATLAB HOMEWORK QUESTION DUE TOMORROW: PLEASE HELP!!! The viscosity of blood depends on many factors (temperature, hematocrit, blood vessel diameter, blood velocity). As such, there isn’t a single formula for calculating blood viscosity. Instead you can interpolate based on formulas and data found in tables. Your job is to design a program to calculate blood viscosity. The key features of the program are: It must ask the user for temperature, hematocrit, blood vessel diameter, and blood velocity. For each of...

  • I had help with a program, it requires constants and 3 functions. Ask the user for...

    I had help with a program, it requires constants and 3 functions. Ask the user for the number of miles on the route, the average speed and the time of day Randomly generate an increase in the route time based upon whether it’s rush hour or not Calculate the minutes in the route based upon miles, average speed and random traffic increase Print out the miles, minutes and a message The program will continue asking the user for another trip’s...

  • This program will ask the user to enter a number of players, then ask the user...

    This program will ask the user to enter a number of players, then ask the user for each player's name and score. Once all of the players have been entered, the program will display a bar chart with each of their scores scaled as a percentage of the maximum score entered. See below for details on exactly how this should work - an example transcript of how the program should work is shown below (remember that values entered by the...

  • Homework 3: Input Validation 1   Objectives control structures console-based user input using Scanner class writing complete...

    Homework 3: Input Validation 1   Objectives control structures console-based user input using Scanner class writing complete programs using two classes: client and supplier 2   User Interface Specification This is a console-based I/O program. Display should go to System.out (print or println) and the program will get user input using the Scanner class. The flow of execution should be as follows: When the program starts, display a one-line introduction to the user Display a menu with 5 options 1. validate zip...

  • Java 1 Some help Please...... 1. Before You Begin Anticipate where things can go wrong Consider...

    Java 1 Some help Please...... 1. Before You Begin Anticipate where things can go wrong Consider how to gracefully shut down the program and save the users data and close files properly. Typically there are two scenarios to make a distinction between: The first is one that which you have absolutely no control over; such as if all the files are where they should be, and that the user has not deleted one or accidentally moved it rather than copied...

  • Please write in ECLIPSE JAVA. Please no buffered readers and please do not use Java’s built...

    Please write in ECLIPSE JAVA. Please no buffered readers and please do not use Java’s built in data structures or data functionality (Like sorting and searching), however stuff like java.util.scanner and wild cards like java.io.* and java.util.* are fine, but please remember I am very much a beginner at this and would much rather understand the material instead of doing it the easier way using built-in data structures. It would also be nice if you could do it in the...

  • java In this project you will implement a trivia game. It will ask random trivia questions,...

    java In this project you will implement a trivia game. It will ask random trivia questions, evaluate their answers and keep score. The project will also have an administrative module that will allow for managing the question bank. Question bank management will include adding new questions, deleting questions and displaying all of the questions, answers and point values. 2. The project can be a GUI or a menu based command line program. 3. Project details 1. Create a class to...

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