Question: How can i fix this code? The wind chill can be calculated from given values of Temp (temperature in Fahrenheit) and Velocity (wind velocity in

How can i fix this code?

The wind chill can be calculated from given values of Temp (temperature in Fahrenheit) and Velocity (wind velocity in miles per hour).

This is the formula for wind chill: Wind chill temperature = 35.74 + 0.6215*Temp - 35.75*Velocity 0.16 + 0.4275*Temp*Velocity0.16.

Write a method using 2 parameters, temperature, and wind velocity, and returns the wind chill temperature. All variables are to be of type double.

Note: The term Velocity 0.16 is written as Math.pow(velocity, 0.16) in Java.

Write a method named calculateWindChill with two parameters that returns the windchill, and call it from main() as shown below. Run the program twice:

Run1: Print the wind velocity, temperature, and wind chill temperature for Temp = 33, Velocity = 45

Run2: Same as 1 but use Temp = -5, Velocity = 10.

Every variable in this program will be of type double. Your main method and your output will probably look something like this.

public class WindChill {

public static void main(String[] args) {

double temp, velocity, windChill;

temp = // you put a value in here.;

velocity = // you put a value in here.;

windChill = calculateWindChill(temp, velocity);

System.out.println("The wind chill for temperature...); //fill in ...

}

// calculateWindChill goes here.

}

Output: The wind chill for temperature (degrees F) = 33.0 and wind velocity (MPH) = 45.0 is 16.45514880390551 degrees Fahrenheit.

Below is the code i wrote.

public class WindChill {

public static void main(String[] args) {

double temp, velocity, windChill;

temp = 33;

velocity = 45;

windChill = calculateWindChill(temp, velocity);

System.out.println("The wind chill for temperature (degree F) = " + temp + " and wind velocity (MPH) = " + velocity + "is " + windChill + "degrees Fahrenheit.");

}

public static void calculateWindChill() {

double Vel = Math.pow(velocity,16);

double calculateWindChill = 35.74 + (0.6215*temp)-(35.75*Vel) + 0.4275*temp*Vel;

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!