PROGRAM 1 (java) guide me to creat a version of the TempConverter application to convert temperature values
Question:
PROGRAM 1 (java)
guide me to creat a version of the TempConverter application to convert temperature values from Fahrenheit to
Celsius. Read the Fahrenheit temperature value from the user.
ALGORITHM
1. Initialize a variable (base) and assign to 32.
2. Initialize another variable (conversion_factor) as "double" to store 5.0/9.0
3. Assign a variable to store Fahrenheit temperature value and Celsius value. To read the values
from user, use the scanner object and print a statement to read the value from the user.
4. Use the formulae to convert the Fahrenheit temperature value to Celsius Temperature value.
a. Celsius = (Fahrenheit-base) * conversion_factor
5. Then print both the temperature values in different lines.
CODE TEMPLATE
//Name:
//Date:
import java.util.Scanner;
public class TempConverter
{
//-----------------------------------------------------------------
// Reads Fahrenheit temperature values and converts the equivalent in Celsius temperature
//-----------------------------------------------------------------
public static void main(String[] args)
{
final int BASE=32;
final double CONVERSION_FACTOR = 5.0/9.0;
double fahrenheitTemp, celsiusTemp;
// use the scanner object to read the temperature value in Fahrenheit from the user
// convert the temperature using the formulae
CelsiusTemp = (fahrenheitTemp - BASE)* CONVERSION_FACTOR;
// print the values of the Fahrenheit Temperature and Celsius Temperature
}
}