Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The wind chill factor (WCF) measures how cold it feels with a given air temperat

ID: 3830193 • Letter: T

Question

The wind chill factor (WCF) measures how cold it feels with a given air temperature T (in degrees Fahrenheit) and wind speed V (in miles per hour). One formula for WCF is WCF = 35.7 + 0.6 T - 35.7 (v^016) + 0.43 t(v^0.16) Write a function to receive the temperature and wind speed as input arguments, and return the WCF. Using loops, print a table showing wind chill factors for temperatures ranging from -20 to 55 in steps of 5, and wind speeds ranging from 0 to 55 in steps of 5. Call the function to calculate each wind chill factor.

Explanation / Answer

package wcf;

public class WindChillFactor {
  
   private static final double INITIAL_TIME = -20;
   private static final double END_TIME = 50;
   private static final double INITIAL_SPEED = 0;
   private static final double END_SPEED = 50;
   private static final double TIME_INTERVAL = 15;
   private static final double SPEED_INTERVAL = 11;
   private static final int LOOP_STEPS = 5;

   public static void main(String[] args) {
      
       WindChillFactor wcf = new WindChillFactor();
       double time = INITIAL_TIME;
       double speed = INITIAL_SPEED;
       for(int i=0; i<LOOP_STEPS; i++) {
           if(time<=END_TIME && speed<=END_SPEED) {
               System.out.println("For time " +time +" and speed " + speed + " WCF is : "+wcf.calculateWCF(time, speed));
               time = time + TIME_INTERVAL;
               speed = speed + SPEED_INTERVAL;
           } else {
               System.out.println("Time and Speed are not in range");
           }
       }
      
   }
  
   public double calculateWCF(double time, double speed) {
       double wcf;
       wcf = 35.7 + 0.6 * time - 35.7 * (Math.pow(speed, 0.16)) + 0.43 * (Math.pow(speed, 0.16));
       return wcf;
   }

}