JAVA method 调用类

问题描述:

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.
..着急,
1个回答 分类:综合 2014-10-27

问题解答:

我来补答
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));
}
}
 
 
展开全文阅读
剩余:2000