Not in a rush but trying to adjust my own code for an online class. I wrote this code following an example for computing interest but doesnt seem to like my double assignment. The problem is compute windchill using the formula below. It will only work if temp is between -58 and 41 degrees with the wind is above 2 mph.
windchill =35.74 + (0.6215*outsideTemp) - (35.75*windspeed^0.16) + (0.4275*outsideTemp*windSpeed^0.16)
original code that i made and ran through online compiler to find errors...
import javax.swing.JOptionPane; public class ComputeWindChill { public static void main(String[] args){ //Enter outside temperature String outsideTemp = JOptionPane.showInputDialog( "Enter Outside Temperature in Farhrenheit. Must be above or equal to -58 degrees and below or equal to 41 degrees."); //Convert outsideTemp String to a double double outsideTemp = Double.parseDouble(outsideTemp); //Enter outside wind speed String windSpeed = JOptionPane.showInputDialog( "Enter Outside Wind Speed in Miles per Hour. Wind speed must be above or equal to 2 MPH."); //Convert windSpeed String to a double double windSpeed = Double.parseDouble(windSpeed); //Calculate windChill double windChill = 35.74 + (0.6215 * outsideTemp) - (35.75 * (Math.pow(windSpeed,0.16))) + (0.4275 * (outsideTemp(Math.pow(windSpeed,0.16)))); //Format to keep the windChill to 2 digits after decimal windChill = (int)(windChill*100)/100.0; //Display results String output = "The current outside wind-chill temperature is" + windChill; JOptionPane.showMessageDialog(null, output); } }
I followed another example in the book and it did not work. I would like to know why it doesnt work since i am currently only in chapter 3. Thank you for the 5 minutes of your time. -JavaCow