Hi again )) I changed the code a bit, it's working now. I simply used Scanner instead of Console.
import java.util.Scanner;
public class WeatherProgram {
private static double fahrenheit;
private static double celsius;
private static double temperature;
private static double windSpeed;
private static double chill;
private static int reply;
private static int reply2 = 1;
public static void main(String[]args){
while(reply2 == 1){
Scanner userInputNumber = new Scanner(System.in);
Scanner repeat = new Scanner(System.in);
System.out.println("Welcome to Weather Conversion. Please choose one of the following numbers: "+"\n");
System.out.println("1. Fahrenheit to Celsius");
System.out.println("2. Celsius to Fahrenheit");
System.out.println("3. Windchill");
System.out.println("4. Quit");
System.out.println(" ");
reply = userInputNumber.nextInt();
if (reply == 1){
System.out.println("Please input fahrenheit temperature: ");
fahrenheit = userInputNumber.nextDouble();
fToC(fahrenheit);
}
if (reply == 2){
System.out.println("Please input celsius temperature: ");
celsius = userInputNumber.nextDouble();
cToF(celsius);
}
if (reply == 3){
System.out.println("Please input the temperature in degrees fahrenheit: ");
temperature = userInputNumber.nextDouble();
System.out.println("Please input wind speed in MPH: ");
windSpeed = userInputNumber.nextDouble();
wcCalc(chill);
}
System.out.println("Do you wish to continue Weather Conversion? press 1 for yes or 2 for no: ");
reply2 = repeat.nextInt();
}
System.out.println("Thank you");
}
public static void fToC(double f){
// removed the double celcius, as it's already declared in class
celsius = ((f-32)*5/9); // check your "5/9" as that's not going to give you a double answer
if (celsius<1){
System.out.println(f + " Fahrenheit = " + celsius + " Celsius. Temperature is below freezing!");
}
if (celsius>32){
System.out.println(f + " Fahrenheit = " + celsius + " Celsius. It is hot!");
}
else{
System.out.println(f + " Fahrenheit = " + celsius + " Celsius.");
}
}
public static void cToF(double c){
//removed double fahrenheit
fahrenheit = ((c*9/5)+32); // check 9/5 math, fix for double
if (fahrenheit<33){
System.out.println(c + " Celsius = " + fahrenheit + " Fahrenheit. Temperature is below freezing!");
}
if (fahrenheit>90){
System.out.println(c + " Celsius = " + fahrenheit + " Fahrenheit. It is hot!");
}
else{
System.out.println(c + " Celsius = " + fahrenheit + " Fahrenheit.");
}
}
public static void wcCalc(double wc){
//removed all restatements of variables
chill = (35.74 + 0.6215 * temperature + (0.4275 * temperature - 35.75) * Math.pow(windSpeed,0.16));
if (chill<-30){
System.out.println("Windchill = " + wc + " Degrees Fahrenheit. Dangerous Windchill!");
}
else{
System.out.println("Windchill = " + wc + " Degrees Fahrenheit");
}
}
}