Just started a Java class and the first HW assingment was issued.
I have read the chapter a million times and cant figure out what the heck am I doing wrong. The assingment is supposed change Celcius temperature to Fahrenheit using a worker class.
import javax.swing.*;
public class ConvertTemperature {
public static void main(String[] args) {
// Get the Celcius Temperature
String getCelcius = JOptionPane.showInputDialog("Enter Celcius");
double celcius = Double.parseDouble(getCelcius);
// Create a CelciusToFahrenheit object that stores the celcius temperature.
CelciusToFahrenheit you = new CelciusToFahrenheit(celcius);
// Display Farenheight temperature.
JOptionPane.showMessageDialog( null, you.surroundCelciusToFahreheit());
}
}
***************************************************
class CelciusToFahrenheit {
private double fahrenheit;
public CelciusToFahrenheit (double celcius ) {
double fahrenheit;
fahrenheit = 1.8 * celcius + 32;
}
public double surroundConvertTemperature() {
return fahrenheit;
}
}
Someone PLEASE help! before I crack........ :cry: