Need help with Java program?
So i'm in an intro to java class and i'm making a Fahrenheit to Celsius converter, just for practice. I got it to work inside bluej, but when I try to run the jar file, nothing happens, but the program says that there are no syntax errors! here is my code:
import java.util.*;
public class main
{
private int farenheit;
main ()
{
farenheit = 70;
}
main ( int f )
{
farenheit = f;
}
public void setFarenheit (int differentFarenheit)
{
farenheit = differentFarenheit;
}
public void askUserForFarenheit ()
{
Scanner keyIn;
keyIn = new Scanner (System.in);
System.out.print ("Enter the temperature in Farenheit: ");
String input = keyIn.nextLine ();
int nFarenheit = Integer.parseInt (input) ;
setFarenheit (nFarenheit);
printCelcius ();
}
public void printCelcius ()
{
int f = farenheit;
double a = (f-32)*5;
double b = a/9;
String weather;
if(b > 32 )
{
weather = "It's quite hot, be sure to use sunscreen!";
}
else if (b < 22)
{
weather = "It's a little chilly, wear a sweater!";
}
else
{
weather = "It's nice and cool.";
}
System.out.println ("The temperature in celcius is " + b + " degrees.");
System.out.println ("Forecast: " + weather);
}
}