fork download
  1. //Windchill Homework 2 by Kenneth Payne
  2. //'main' method must be in a class 'Rextester'.
  3. //Compiler version 1.8.0_45
  4.  
  5. import java.util.Scanner; //for inputs
  6.  
  7. class Rextester
  8. {
  9. public static void main(String [] args)
  10. {
  11. Scanner sc = new Scanner(System.in);
  12. double windSpeed, temperature, windChill;
  13.  
  14. //user input
  15. System.out.println("Enter temperature between -58 and 41 degrees Fahrenheit.: ");
  16. temperature = sc.nextDouble();
  17. System.out.print("Enter wind speed greater than or equal to 2: ");
  18. windSpeed= sc.nextDouble();
  19.  
  20. //calculate wind chill
  21.  
  22. windChill = 35.74 + 0.6215 * temperature + (0.4275 * temperature - 35.75) * Math.pow(windSpeed, 0.16);
  23. //print results
  24. System.out.println("Wind chill is: " + Math.floor(windChill));
  25.  
  26.  
  27. }
  28. }
Success #stdin #stdout 0.03s 26036KB
stdin
vdhd
stdout
//Windchill Homework 2 by Kenneth Payne
//'main' method must be in a class 'Rextester'.
//Compiler version 1.8.0_45

import java.util.Scanner; //for inputs

class Rextester
{  
    public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        double windSpeed, temperature, windChill;
        
        //user input
        System.out.println("Enter temperature between -58  and 41 degrees Fahrenheit.: ");
        temperature = sc.nextDouble();
        System.out.print("Enter wind speed greater than or equal to 2: ");
        windSpeed= sc.nextDouble();
        
        //calculate wind chill
        
       windChill = 35.74 + 0.6215 * temperature + (0.4275 * temperature - 35.75) * Math.pow(windSpeed, 0.16);
       //print results
       System.out.println("Wind chill is: " + Math.floor(windChill));
                                                   
                         
    }
}