ok so i took out the beginnig which was just labeling them.. it keeps erroring near my if else statements and also my settext statments? says ")" expected and illegal start of epression for if else. im new to this and confused any help would be appreciated. also, for this im supposed to be using parametres, the lesson i got barely explains what that is.. so any help.. thank you
inches = Double.parseDouble(jTextField2.getText()); // get txt from txtfield to show te value
feet = Double.parseDouble(jTextField2.getText());
yards = Double.parseDouble(jTextField2.getText());
metres = Double.parseDouble(jTextField2.getText());
//choose conversions 1-4
//conv1
String textfieldinput = jTextField1.getText(); //getting txt and making it check if equal
if(textfieldinput.equals("1"))
centimetres = inches*2.54;
jLabel8.setText( inches + "inches" + " = " + inches*2.54 "cm");
//conv2
if else (textfieldinput.equals("2"))
centimetres = feet*30;
jLabel8.setText(feet + "feet" + " = " + feet*30 "cm");
//conv3
if else (textfieldinput.equals("3"))
metres = yards*0.91;
jLabel8.setText(yards + "yards" + " = " + yards*0.91 "metres");
//conv4
if else (textfieldinput.equals("4"))
kilometres = metres*1.6;
jLabel8.setText(metres "metres" + " = " + metres*1.6 "km");
Aucun commentaire:
Enregistrer un commentaire