Please this is my Question
(Conversions between Celsius and Fahrenheit) Write a class that contains the following two methods:
/*
* Convert from Celsius to Fahrenheit
*/
public static double celsiusTFahrenheit (double celsius)
/*
* Convert from Fahrenheit to Celsius
*/
public static double fahrenheitToCelsius (double fahrenheit)
Chapter 6 Methods
The formula for the conversion is as follows:
fahrenheit = (9.0 / 5) * celsius + 32
celsius = (5.0 / 9) * (fahrenheit - 32)
Write a test program that invokes these methods to display the following table:
Celsius
40.0
39.0
38.0
37.0
36.0
35.0
34.0
33.0
32.0
31.0
Fahrenheit
104.0
102.2
100.4
98.6
96.8
95.0
93.2
91.4
89.6
87.8
Fahrenheit
120.0
110.0
100.0
90.0
80.0
70.0
60.0
50.0
40.0
30.0
Celsius
48.89
43.33
37.78
32.22
26.67
21.11
21.11
10.00
4.44
-1.11
6.9 (Conversions between feet and meters) Write a class that contains the following two methods:
/*
* Convert from feet to meters
*/
public static double footToMeter (double foot)
/*
* Convert from meters to feet
*/
public static double meterToFoot (double meter)
The formula for the conversion is:
meter = 0.305 *foot
foot = 3.279 * meter
Write a test program that invokes these methods to display the following tables:
Feet
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
10.0
Meters
0.305
0.610
0.915
1.220
1.525
1.830
2.135
2.440
2.745
3.050
Meters
20.0
25.0
30.0
35.0
40.0
45.0
50.0
55.0
60.0
65.0
- _ _ _ _ Feet.
65.574
81.967
98.361
114.754
131.148
147.541
163.934
180.328
196.721
213.115
And this is my code is it correct and what is the compelet of it
public class Lab12 {
public static double celsiusToFahrenheit(double num){
double fahrenheit = (9.0 / 5) * num + 32;
return fahrenheit;
}
public static double fahrenheitToCelsius (double num){
double celsius = (5.0/ 9) * (num - 32);
return celsius;
}
public static double feetToMeters(double num1){
double meters =0.305 * num1;
return meters;
}
public static double metersToFeet( double num2){
double feet = 3.279 * num2;
return feet;
}
public static void main(String[] args) {
double celsius;
double fahrenheit;
System.out.println(" Celsuis Fahrenheit | Fahrenheit Celsuis ");
System.out.println("----------------------------------------------------");
for(celsius = 40.0, fahrenheit = 120.0; celsius > 31.0; celsius--, fahrenheit -= 10){
System.out.println(celsius + "\t" + celsiusToFahrenheit(celsius) + "|" + fahrenheit + "\t" + fahrenheitToCelsius(fahrenheit));
}
double feet;
double meters;
System.out.println(" feet meters | meters feet ");
System.out.println("----------------------------------------------------");
for(feet = 1.0, meters = 20.0; feet <= 10.0; feet++ , meters += 5){
System.out.println( feet + "\t" + feetToMeters(feet) + "|" + meters + "\t" + metersToFeet(meters));
}
}
}