help w/ conversion of degrees(CtoF, FtoC)
here is what we're supposed to do
This assignment is a Celsius to Fahrenheit and Fahrenheit to Celsius temperature conversion program.
Write a class that contains the following two methods ( class will have a total of 3 methods ):
public static double celtofahr ( double celsius)
and public static double fahrtocel ( double fahrenheit )
main should prompt the user for a celsius, call / use the celtofahr method to do the conversion, next display the result to the user. Next, prompt the user for a Fahrenheit, call / use the fahrtocel method to do the conversion, next display the result to the user.
Note : the formula for conversion is
fahrenheit = ( ( 9.0 / 5.0 ) * celsius ) + 32
WHERE DO I PUT THE STRING TO PROMPT THE USER TO ENTER EACH DEGREE?
here is my code
public class Assign8_Roberts{
private double fahrenheit;
private double celsius;
private String displayString;
public Assign8_Roberts (double Fahrenheit, double Celsius)
{
this.fahrenheit = Fahrenheit;
this.celsius = Celsius;
}
public double GetFahrenheitTemp()
{
return this.fahrenheit;
}
public double FahrtoCel(double fahrenheit)
{
double result = (fahrenheit - 32)/1.8;
return result;
}
public double GetCelsiusTemp()
{
return this.celsius;
}
public void FahrenheitTemp(double fahrenheitVal)
{
this.fahrenheit = fahrenheitVal;
}
public double CeltoFahr(double celsius)
{
double result = (1.8 * celsius) + 32;
return result;
}
public void CelsiusTemp(double celsiusVal)
{
this.celsius = celsiusVal;
}
}