私はJavaで面積計算機を作って、ユーザが与えた寸法に基づいて三角形の面積を計算しようとしています。メニューから三角形オプションを選択して寸法を入力させることができますが、方法を使って面積を計算しようとすると、0.0
しか印刷されません。ジオメトリエリア計算機
{
Scanner tbaseChoice = new Scanner(System.in);
System.out.println("What is the base?");
double selectionb = tbaseChoice.nextDouble();
tbaseChoice.equals(Tbase);
Scanner theightChoice = new Scanner(System.in);
System.out.println("What is the height?");
double selectionh = theightChoice.nextDouble();
theightChoice.equals(Theight);
System.out.println("BASE:" + selectionb + " " + "HEIGHT:" + selectionh);
//tbaseChoice.equals(Tbase);
//theightChoice.equals(Theight);
}
public static void calculateArea() {
double triangleArea = Theight * Tbase;
System.out.print("Area=" + triangleArea);
}
うわーありがとう!以前このウェブサイトで初めて使用されていたので、あなたの反応は時宜にかなって役立ちました。 –