Code example for Scanner

Methods: nextDoublenextInt

0
 * @author springtree 
 */ 
import java.util.Scanner; 
public class Q2_17 { 
    public static void main(String[] args)  {
        Scanner input = new Scanner (System.in);
         
        System.out.println ("Enter the temperature in Fahrenheit: ");
        double temperature = input.nextDouble();
         
        System.out.println ("Enter the wind speed miles per hour: ");
        int speed = input.nextInt();
         
        if (temperature > -58 && temperature < 41 && speed >= 2)    {
            double tempWindChill = 35.74 + 0.6215 * temperature - 35.75 * Math.pow(speed, 0.16) + 0.4275 * temperature *Math.pow(speed, 0.16);
            System.out.println ("The wind chill index is " + tempWindChill);
        }    
        else    { 
           System.out.println ("Please enter right values ");
        }