Question

This program will take the user's input as a temperature in degrees Fahrenheit. The user will then click a radio button indicating whether a table of temperatures, starting with the entered value, will be displayed in increments of 5 degrees F or 10 degrees F. When a submit button is clicked your code will display a HTML table of temperature values. The first column will be temperatures in degrees Fahrenheit, given in increments of 5 or 10 degrees F, depending on the radio button clicked. The second column of the table will be the Celsius equivalent of the Fahrenheit temperature.

   degC = (degF - 32) / 1.8;

The table will include a 100 degree F range. So, if the user enters 50 and clicks the 10 degree increment radio button, the table will include 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, and 150 degrees Fahrenheit values and their Celsius equivalents. If the user enters 50 and clicks the 5 degree increment radio button, the same temperature range will be displayed for degrees F, but in increments of 5 (50, 55, 60, 65, ..., 140, 145, 150).

Temperature Conversion Table Enter a starting value in degrees Fahrenheit and an increment value. 20 Enter an value in degrees Fahrenheit. Convert in increments in 5 degrees Convert in increments in 10 degrees

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

C file:///C:/Test/TempConverter.html Degrees Fahrenheit Degrees Celcius 20 30 40 50 60 70 80 90 100 110 120 6.67 1.11 4.44 10

TempConverter.html

<!DOCTYPE html>

<html>

<head>

<script>

//Function to perform conversion

function convertToCelcius() {

var degF = parseInt(document.forms["myTemperatureForm"]["temperatureInFahrenheit"].value);

var degreeIncrementVal = 0;

//Check increment value

if(document.getElementById("degIncrement5").checked==true)

{

degreeIncrementVal = 5;

}

else if(document.getElementById("degIncrement10").checked==true)

{

degreeIncrementVal = 10;

}

document.write("<table border='1'>");

document.write("<tr>");

document.write("<th>Degrees Fahrenheit</th>");

document.write("<th>Degrees Celcius</th>");

document.write("</tr>");

//Iterate calculate and print value

for(var i=0;i<=10;i++)

{

var temp = parseInt(degF)+parseInt(i)*parseInt(degreeIncrementVal);

var degC = (temp - 32) / 1.8;

document.write("<tr>");

document.write("<td>"+(degF+i*degreeIncrementVal)+"</td>");

document.write("<td>"+Math.round(degC * 100) / 100+"</td>");

document.write("</tr>");

}

document.write("</table>");

}

</script>

</head>

<body>

<h2>Temperature Conversion Table</h2>

<h4>Enter a starting value in degrees Fahrenheit and an increment value.</h4>

<!-- Create form to accept inputs -->

<form name="myTemperatureForm"

onsubmit="convertToCelcius()" method="post">

<input type="text" name="temperatureInFahrenheit"> Enter an value in degrees Fahrenheit<br>

<input type="radio" name="degIncrement" id="degIncrement5"> Convert in increment in 5 degrees<br>

<input type="radio" name="degIncrement" id="degIncrement10"> Convert in increment in 10 degrees

<br/><br/><input type="submit" value="Submit">

</form>

</body>

</html>

Add a comment
Know the answer?
Add Answer to:
This program will take the user's input as a temperature in degrees Fahrenheit. The user will...
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 function that takes temperature in degrees Fahrenheit as input and returns the temperature in...

    Write a function that takes temperature in degrees Fahrenheit as input and returns the temperature in degree Celsius as output. Here is the signature of the function: double toCelsius (double) Following is the formula to convert °F to °C:

  • Create a program in Python that will allow the user to enter a temperature in Fahrenheit...

    Create a program in Python that will allow the user to enter a temperature in Fahrenheit which will then be converted to degrees Celsius. The program will keep asking the user for a Fahrenheit temperature until the user enters Q to quit. After each conversion the program needs to print out the degrees Celsius. The input prompts for this problem need to look like the following: Degrees Fahrenheit: Continue: For these input prompts watch the capitalization and spacing. There are...

  • 8.) Write a C++ program to convert temperature in degrees Fahrenheit to degrees Celsius. This is...

    8.) Write a C++ program to convert temperature in degrees Fahrenheit to degrees Celsius. This is the equation for this conversion: Celsius = 5.0/9.0 (Fahrenheit-32.0) Have your program convert and display the Celsius temperature corresponding to 98.6 degrees Fahrenheit. Your program should produce the following display (replacing the underlines with the correct values): For a Fahrenheit temperature of-_ degrees, the equivalent Celsius temperature is degrees

  • Temperature Converter Create a temperature conversion program that will convert the following to Fahrenheit: Celsius Kelvin...

    Temperature Converter Create a temperature conversion program that will convert the following to Fahrenheit: Celsius Kelvin Newton Your program should take a character which represents the temperature to convert from and a value to be converted to using the following specification: C - Celsius K - Kelvin N - Newton In addition your program should take in the following character to exit the program: X - eXit the program The numeric input for your program should be of type double....

  • Needs to be solved in MATLAB Problem 4 Produce a conversion table for Celsius and Fahrenheit...

    Needs to be solved in MATLAB Problem 4 Produce a conversion table for Celsius and Fahrenheit temperatures. The input to the function should be two numbers: Tlower and Tupper Which define the lower and upper range, in Fahrenheit, for the table The output of the function should be a two column matrix with the first column showing the temperature in Fahrenheit, from Tlower (32 °F) to Tupper (212 °F) with an increment of 5 °F, and the second column showing...

  • C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have...

    C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have 2 Labels (each one of them assigned only to Celsius and Fahrenheit), 2 TextBoxes (each one of them assigned only to Celsius and Fahrenheit), only 1 Convert Button, 1 Clear Button, and 1 Exit Button. Also, 1 Error message label which will display the error messages. The application should only allow the user to enter the desired temperature just in one of the TextBoxes...

  • Java program Write a Temperature class that represents temperatures in degrees in both Celsius and Fahrenheit....

    Java program Write a Temperature class that represents temperatures in degrees in both Celsius and Fahrenheit. Use a floating- point number for the temperature and a character for the scale, eitherでfor Celsius or 'F' for fahrenheit. The class should have Four constructors: one for the number of degrees, one for the scale, one for both the degrees and scale, and a default constructor. For each of these constructors, assume zero degrees if no value is specified and celsius if no...

  • Write a program named FahrenheitToCelsius that accepts a temperature in Fahrenheit from a user and converts...

    Write a program named FahrenheitToCelsius that accepts a temperature in Fahrenheit from a user and converts it to Celsius by subtracting 32 from the Fahrenheit value and multiplying the result by 5/9. Display both values to one decimal place. For example, if 88.5 degrees is input, the output would be: 88.5 F is 31.4 C Answer in C# (Posting incomplete code i have so far that wont run correctly.) using System; using static System.Console; class FahrenheitToCelsius { static void Main()...

  • Question: Fahrenheit To Celsius Temperature Converter GUI Assignment Write A GUI To... java Fahrenholt to Celsius...

    Question: Fahrenheit To Celsius Temperature Converter GUI Assignment Write A GUI To... java Fahrenholt to Celsius Temperature Converter GUI Assignment Write a Gul to convert Fahrenheit temperatures to Celsius temperatures and has the following appearance: Com Convert It must include the following foatures • The frame we must say 'Fahrenheit to Celsius Temperature Converter • A border layout will be used for the GUI • The JLabelite of the GUI wil suy Fahrerholt to Celsius Temperature Converter and be in...

  • Write a C++ program that prompts a user to enter a temperature in Fahrenheit as a...

    Write a C++ program that prompts a user to enter a temperature in Fahrenheit as a real number. After the temperature is entered display the temperature in Celsius. Your program will then prompt the user if they want to continue. If the character n or N is entered the program will stop; otherwise, the program will continue. After your program stops accepting temperatures display the average of all the temperatures entered in both Fahrenheit and Celsius. Be sure to use...

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