1.60 米 转换Height:Ft In

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/02 17:41:18
1.60 米 转换Height:Ft In
xRKN07HNhnZ!*Ckca~ #p lk:%)U8xdb|Ϸ; H*^i,Trc

1.60 米 转换Height:Ft In
1.60 米 转换Height:Ft In

1.60 米 转换Height:Ft In
class Convert{
public static final int M=1;
public static final int DM=2;
public static final int CM=3;
public static ImperialLength toImperial(double length,int unit){
switch(unit){
case M:length/=0.0254;break;
case DM:length/=0.254;break;
case CM:length/=2.54;break;
default:return null;
}
int inches=(int)(Math.round(length/2.54));
return new ImperialLength(inches/12,inches%12);
}
public double toMetric(int feet,int inch){
return (feet*12+inch)*0.0254;
}
}
class ImperialLength{
public int feet;
public int inch;
public ImperialLength(int feet,int inch){
this.feet=feet;
this.inch=inch;
}
}