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/04/27 05:28:23
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 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));
}
}