package method;
import method.HuaShe;
public class TestCToFandFToC {
public static void main(String[] args){
System.out.println("摄氏 华氏 华氏 摄氏");
for(int i = 1;i <= 10;i++){
double she1 = 40.0;
double hua1 = cToF(she1);
double hua2 = 120.0;
double she2 = fToC(hua2);
System.out.println(she1 + " " + hua1 + " " + hua2 + " " + she2);
she1 -= 1;
hua2 -= 10;
}
}
}
package method; public class HuaShe { static double cToF(double c){ double ft = (9.0 / 5) * c + 32; double f = (int)(ft * 100) / 100.0; return f; } //-------------------------------------- static double fToC(double f){ double ct = (f - 32) / (9.0 / 5); double c = (int)(ct * 100) / 100.0; return c; } }
然后运行主函数时
cToF(she1);和fToC(hua2);报错:
The method cToF(double) is undefined for the type TestCToFandFToC
为什么会这样???
谢谢!
qq_花开花谢_0
白猪掌柜的
米琪卡哇伊
暮色呼如
开心每一天1111
守着一只汪
相关分类