Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with this question. I need it in HTML5 format. Implement the followi

ID: 3784682 • Letter: I

Question

I need help with this question. I need it in HTML5 format.

Implement the following functions: (a) Function Celsius returns the Celsius equivalent of a Fahrenheit temperature, using the calcuation: C = 5.0 / 9.0 * (F-32); (b) Function fahrenheit returns the Fahrenheit equvalent of a Celsius temperature, using the calculation F = 9.0/5.0 * C +32; (c) Use these functions to write a script that enables the user to enter eigher a Fahrenheit or a Celsius temperature and displays the Celsius or Fahrenheit equivalent. Your HTML5 document should contain two buttons -- one to initiate the conversion from Fahrenheit to Celsius and one to initiate the conversion from Celsius to Fahrenheit. Here is what the output should look like.

Degrees to convert: 100 Convert to Celsius Convert to Fahrenheit 100 converted to Celsius is 37.77777777777778

Explanation / Answer

Following is the code to 1) Convert Celsius value to Fahrenheit 2) Fahrenheit value to Celsius 3) Convert value on change event.

Preocess to run the program:

1) Copy - Paste the below code to any text editor and save the file with ".html" extension.

2) Go to file explorer and open the HTML file using any browser.

<html>
<head>
<title>Temperature format change - Solution</title>
<script>
var opt = "celsius";
function celsius()
{
opt = "celsius";
var val = document.getElementById("degrees").value;
var ans = 5 / 9 * (parseFloat(val)-32);
document.getElementById("result_degree").innerHTML = val;
document.getElementById("opt").innerHTML = opt;
document.getElementById("result").innerHTML = ans;
}
  
function fahrenheit()
{
opt = "fahrenheit";
var val = document.getElementById("degrees").value;
var ans = 9 / 5 * parseFloat(val)+32;
document.getElementById("result_degree").innerHTML = val;
document.getElementById("opt").innerHTML = opt;
document.getElementById("result").innerHTML = ans;
}
  
function recalculate()
{
if(opt==="celsius")celsius();
else fahrenheit();
}
</script>
</head>
<body>
<label for="degrees">Degrees to convert: </label><input id="degrees" type="number" value="0" />
<input type="button" value="Convert to Celsius"/>
<input type="button" value="Convert to Fahrenheit"/>
<br/><br/>
  
<span id="result_degree">0</span> converted to <span id="opt">celsius</span> is: <span id="result">-</span>
</body>
</html>