HELLO!!!
I am writing a program to convert Celsius to Fahrenheit using a for loop. Since I have such problems with for loops and LOGIC in general, I need help! Here is a sample of what I've written so far. There is an output in the textbook that needs to be mirrored in the program that decrements the C temp from 40 to 31 and prints out the F equivalent. Please give me some clues and pointers!!!
package Chapter4;
import Chapter2.MyInput;
public class ConvertTemp
{
//Main method
public static void main(
String[] args)
{
System.out.println("Cels.Temp. Fahr.Temp.");
System.out.println("------------------------------");
}
}
//Class containing C to F conversion method
class CelsToFahr{
//Find the Fahrenheit equivalent for Celsius value
public static double CelsToFahr(double Cels)
{
double Fahr = 32.00;
// Fahr= ((9/5)*Cels)+32;
// for(Cels = 0; Cels < Fahr; Cels++)
do
{
Fahr = ((9.0/5.0)*Cels)+32;
Cels = (Fahr - 32.0)*(5.0/9.0);
//if(Cels == 40.00)
// Fahr= ((9/5)*Cels)+32;
}
while(Cels == 40.00);
// return Fahr;
System.out.println(Fahr);
}
}