好吧,我对整体产品有问题,我是新手,所以我无法发现我出错的地方。我输入我的转换类型ex:1(英寸 - 厘米)说我想知道多少厘米5英寸,它会导致说:12.7厘米= 55.0?对我来说有意义,为什么它这样做,任何帮助都会很棒!
switch(Integer.parseInt(jTextField1.getText())){
case 1:
InchesToCm();
break;
case 2:
CmToFeet();
break;
case 3:
MetresToYards();
break;
case 4:
KmToMetres();
break;
default:
jLabel8.setText("Error, try again");
break;
}
}
private void InchesToCm() {
double inches, centimetres; //identify variables
String messageOut;
inches = Double.parseDouble(jTextField2.getText()); //get the text
centimetres = (inches*2.54); //preform
messageOut = centimetres + "cm = " + Math.round(inches) + inches; //msg
jLabel8.setText(messageOut);
}
private void CmToFeet() {
double feet, centimetres;
String messageOut;
feet = Double.parseDouble(jTextField2.getText());
centimetres = (feet*30);
messageOut = centimetres + "cm = " + Math.round(feet) + feet;
jLabel8.setText(messageOut);
}
private void MetresToYards() {
double metres, yards;
String messageOut;
yards = Double.parseDouble(jTextField2.getText());
metres = (yards*0.91);
messageOut = metres + "m = " + Math.round(yards) + yards;
jLabel8.setText(messageOut);
}
private void KmToMetres() {
double miles, kilometres;
String messageOut;
miles = Double.parseDouble(jTextField2.getText());
kilometres = (miles*1.6);
messageOut = kilometres + "km = " + Math.round(miles) + miles;
jLabel8.setText(messageOut);
}
答案 0 :(得分:2)
您要连续两次打印lemma "(χ x y. (x, y)) $ 1 $ 2 = (1,2)" by simp
term "(χ x y z. (x, y + z))"
(* "χ x y z. (x, y + z)" :: "'a ^ 3 ⇒ 'a × 'a" *)
变量并让自己感到困惑。 inches
返回值负责Math.round
,5
本身(inches
)的打印负责double
。连接后,它显示为5.0
。我怀疑你想要打印 string 55.0
:
"inches"
应该对其他方法进行类似的更改。