This exercise will give you some practice using arithmetic expressions. To start, this application should display a prompt dialog box like the one below that gets the temperature in Fahrenheit degrees: see image.

Then, it should display an alert dialog box like the one below that displays the temperature in Celsius:see image.

To convert a Fahrenheit temperature to Celsius, you subtract 32 from the Fahrenheit degrees and multiply that result by 5/9.

1. Here's some starting JavaScript code for this application, including a while loop and a prompt statement for getting the users entry while the entry amount isnt 999. Copy the HTML below into a file called convert_degrees.html.

< !DOCTYPE html>
< html>
< head>
< meta charset="utf-8">
< title>Convert F degrees to C degrees< /title>
< script src="http://html5shiv.googlecode.com/svn/trunk/html5.js">< /script>
< script>
var entry;
do {
entry = prompt("Enter degrees in Fahrenheitn" +
"Or enter 999 to end entries", 999);
entry = parseInt(entry);
}
while (entry != 999);
< /script>
< /head>
< body>
< section>
< h1>This page is displayed after the JavaScript is executed< /h1>
< /section>
< /body>
< /html>

2. Write the JavaScript code for deriving Celsius from Fahrenheit and displaying it in an alert dialog box as shown above. An alert box is similar to the prompt box and uses the syntax

alert("String") ;
alert(variablename);
alert(variablename + "String");
alert("String" + variablename);
alert(variablename1 + variablename2 + variablename3);
alert("String" + variablename2 + variablename3);

and so on....

3. Add data validation to the application to make sure the entry is a valid number. If the entry is invalid, the application should just display the starting prompt dialog box again. It doesnt need to display a special error message.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.