当我尝试编译它时,我得到一个错误“;” 排队
double cm1 (inch_to_cm*2.54);
它必须在相同的窗口中:厘米到英寸/英尺英寸到厘米/米。
import java.util.Scanner;
public class Centimer_Inch
{
public static void main (String[] args)
{
// 2.54cm is 1 inch
Scanner cm = new Scanner(System.in); //Get INPUT from pc-Keyboard
System.out.println("Enter The Centimeters:"); // Write input
double centimeters = cm.nextDouble(); // STAM מקבל את הסנטימטר
double inches = Math.round( (centimeters / 2.54) * 100 ) / 100.0; // STAM לוקח את הסנטימטר ומחלק ב2.54
System.out.println(inches +"Inches");
double foot=Math.round( (inches/12) *100) / 100.0;
System.out.print(foot +"Foots");
// inch to cm
Scanner inch1 = new Scanner(System.in);
System.out.println("Enter The Inch");
double inch_to_cm = inch1.nextDouble();
double cm1 (inch_to_cm*2.54); //From INCH TO CM
System.out.println(inch_to_cm);
}
}