JAVA method 调用类 Theformula for converting a temperature from Fahrenheit to Celsius isC= 5/9 * (F – 32)WhereF is the Fahrenheit temperature and C is the Celsius temperature.Write a methodnamed Celsius that accepts a single argument,the tempera
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/30 08:31:03
![JAVA method 调用类 Theformula for converting a temperature from Fahrenheit to Celsius isC= 5/9 * (F – 32)WhereF is the Fahrenheit temperature and C is the Celsius temperature.Write a methodnamed Celsius that accepts a single argument,the tempera](/uploads/image/z/8646674-50-4.jpg?t=JAVA+method+%E8%B0%83%E7%94%A8%E7%B1%BB+Theformula+for+converting+a+temperature+from+Fahrenheit+to+Celsius+isC%3D+5%2F9+%2A+%28F+%E2%80%93+32%29WhereF+is+the+Fahrenheit+temperature+and+C+is+the+Celsius+temperature.Write+a+methodnamed+Celsius+that+accepts+a+single+argument%2Cthe+tempera)
JAVA method 调用类 Theformula for converting a temperature from Fahrenheit to Celsius isC= 5/9 * (F – 32)WhereF is the Fahrenheit temperature and C is the Celsius temperature.Write a methodnamed Celsius that accepts a single argument,the tempera
JAVA method 调用类
Theformula for converting a temperature from Fahrenheit to Celsius is
C= 5/9 * (F – 32)
WhereF is the Fahrenheit temperature and C is the Celsius temperature.Write a methodnamed Celsius that accepts a single argument,the temperature in Fahrenheit.The method should return the temperature converted to Celsius.Demonstrate themethod by calling it in a loop that displays a table of Fahrenheit temperatures0 through 20 and their Celsius equivalents.
..着急,
JAVA method 调用类 Theformula for converting a temperature from Fahrenheit to Celsius isC= 5/9 * (F – 32)WhereF is the Fahrenheit temperature and C is the Celsius temperature.Write a methodnamed Celsius that accepts a single argument,the tempera
public class Demo {
public static void main(String[] args) {
Demo demo = new Demo();
for(int i=0;i<=20;i++){
System.out.println("华氏度:"+i+"对应的摄氏度是:"+demo.zhuanHuan(i));
}
}
public Double zhuanHuan(int F){
return (((double)5/9)*(F-32));
}
}