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

Write a driver that allows the user to enter a temperature in either Celsius or

ID: 3883386 • Letter: W

Question

Write a driver that allows the user to enter a temperature in either Celsius or Fahrenheit and then prints the temperature value in Fahrenheit, and Celsius along with the wind chill index. Allow the user to change the value of the temperature (either scale) and the speed of the wind in miles per hour. Then display the same information anytime the user changes a value. Allow the user to continue changing values until they enter a ‘q’ or ‘Q’ to quit Create only ONE instance of the WindChill class and one instance of the TemperatureConversion class. After that, call the appropriate set( ) methods. Validate user input for the following input: Allow only: T or t to change temperature S or s to change wind speed F or f for Fahrenheit C or c for Celsius

Explanation / Answer

Note: I need to add some code.But just to show you the frame I am submitting.If u need any modifications just tell me.So that will develop accordingly. thank you

_________________

WindChill.java

public class WindChill {

private double temp;

private double windV;

public WindChill() {

}

public WindChill(double temp, double windV) {

this.temp = temp;

this.windV = windV;

}

public double getTemp() {

return temp;

}

public void setTemp(double temp) {

this.temp = temp;

}

public double getWindV() {

return windV;

}

public void setWindV(double windV) {

this.windV = windV;

}

//Function Implementation which calculates windchill

double windchill(double temp,double windV)

{

//Calculating the windchill

double windchill=35.74+0.6125*temp+(0.4275*temp-35.74)*Math.pow(windV,0.16);

return windchill;

}

}

_________________

TemperatureConversion.java

public class TemperatureConversion {

private double temp;

public TemperatureConversion(double temp) {

this.temp = temp;

}

public double fahrenheitToCelsius(double tempFah) {

double t = (tempFah - 32) * (5.0 / 9.0);

return t;

}

public double celsiusToFahrenheit(double tempCel) {

double t = tempCel * (9.0 / 5.0) + 32;

return t;

}

}

_____________________

Driver.java

import java.util.Scanner;

public class Driver {

public static void main(String[] args) {

char temp;

double f = 0, c = 0,windV=0.0;

/*

* Creating an Scanner class object which is used to get the inputs

* entered by the user

*/

Scanner sc = new Scanner(System.in);

while (true) {

// Getting the character from the user 'F' or 'f' or 'C' or 'c'

System.out

.print("Do you want to Enter the temperature in Fahrenheit or Celsius (F/C) :");

temp = sc.next(".").charAt(0);

if (temp == 'F' || temp == 'f') {

System.out.print("Enter Temperature in Fahrenheit (F) :");

f = sc.nextDouble();

break;

} else if (temp == 'C' || temp == 'c') {

System.out.print("Enter Temperature in Fahrenheit (F) :");

c = sc.nextDouble();

break;

}

else {

System.out.println(":: Invalid input ::");

continue;

}

}

System.out.print("Enter wind velocity (miles/hr):");

windV=sc.nextDouble();

TemperatureConversion tc=new TemperatureConversion(temp);

WindChill wc=new WindChill(f,windV);

if(temp=='F' || temp=='f')

{

System.out.println("The Temperature in Fahrenheit (F) :"+f);

System.out.println("The Temperature in Celsius (C) :"+tc.fahrenheitToCelsius(f));

System.out.println("Wind Chill is :"+wc.windchill(f, windV));

}

else

{

System.out.println("The Temperature in Celsius (C) :"+c);

System.out.println("The Temperature in Fahrenheit (F) :"+tc.celsiusToFahrenheit(c));

System.out.println("Wind Chill is :"+wc.windchill(tc.celsiusToFahrenheit(c), windV));

}

}

}

__________________

Output:

Do you want to Enter the temperature in Fahrenheit or Celsius (F/C) :F
Enter Temperature in Fahrenheit (F) :45
Enter wind velocity (miles/hr):90
The Temperature in Fahrenheit (F) :45.0
The Temperature in Celsius (C) :7.222222222222222
Wind Chill is :29.400248373766217

________________Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote