Hey guys so I made this code for wind chill temp and Im stuck on one part.
the part Im stuck on is that he wants a programs with dialog boxs and restriction
"temp ranges -58 - 41 and wind speed greater than or equal to 2. He wants us to have in there that if the user types in an invalid number for both parts a box will pop up and say error.
I have tried if and else statemnts but i get red line so can someone look over it and help me modify it please
import javax.swing.JOptionPane; public class Temperature { public static void main(String[] args) { String Temp = JOptionPane.showInputDialog("Enter outside Temperature in Farhrenheit. Temp should be between -58F and 41F"); double Temperature = Double.parseDouble(Temp); String Wind = JOptionPane.showInputDialog("What is the MPH of the wind ex: q.2.3.4.5.6 ect."); double WindSpeed = Double.parseDouble(Wind); double Chill = 35.74 + (0.6215 * Temperature) + (35.75 * (Math.pow(WindSpeed, 0.16))) + (0.4275 * (Temperature * (Math.pow(WindSpeed, 0.16)))); Chill = (int) (Chill * 100 / 100.0); System.out.println("The Wind-Chill Temperature is:" + Chill); }//end of main method }