Write a function that takes temperature in Fahrenheit (T) and wind speed in mile
ID: 3712315 • Letter: W
Question
Write a function that takes temperature in Fahrenheit (T) and wind speed in miles per hour (W) and returns a wind chill factor WCF 35.7 0.6T -35.7w016 + 0.43TW0.16 Write a function that takes a starting temperature (F), ending temperature, starting wind speed (mph), ending wind speed and an increment (scalar). The function should calculate a table with wind chill factors for each temperature and wind speed incrementing bot temperature and wind speed by the value in the increment. Use the first function as a local function to calculate the wind chill factor. The first row of the table should have the wind speeds and the first column of the table should have the temperatures. Put a 0 in row 1 column1 of the table. For example, if the function is called with the arguments (10,20,5,15,2), the table should display temperatures from 10 to 20 by twos and wind speed from 5 to 15 by twos. See below. WindChilTable- 0 5.0000 7.0000 9.0000 11.0000 13.0000 15.0000 10.0000 -3.9290 -6.4528 -8.4284 -10.0641 -11.4663 -12.6976 12.0000 -2.7290 -5.2528 -7.2284 -8.8641 -10.2663 -11.4976 14.0000 -1.5290 -4.0528 -6.0284 -7.6641 -9.0663 -10.2976 16.0000 -0.3290 -2.8528 -4.8284 -6.4641 -7.8663 -9.0976 18.0000 0.8710 -1.6528 -3.6284 -5.2641 -6.6663 -7.8976 20.0000 2.0710 -0.4528 -2.4284 -4.0641 -5.4663 -6.6976Explanation / Answer
The below function is written in java and the function takes the parameters as mentioned in the question. the function will not return any value but prints values as mentioned
public static void printWindChillFactor(int stemp,int etemp,int sws, int ews, int increment){
double w=sws;
System.out.print("0 ");
for(;w<=ews;){
System.out.print(w+" ");
w+=increment;
}
double t=stemp;
for(;t<=etemp;){
w=sws;
System.out.print(t+" ");
for(;w<=ews;){
double wfc = 35.7 + 0.6*t - 35.7*(Math.pow(w,0.16)) + 0.43*t*(Math.pow(w,0.16));
System.out.print(wfc+" ");
w+=increment;
}
System.out.println();
t+=increment;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.