사용자가 주어진 치수를 기반으로 삼각형의 면적을 계산하는 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);
}
와우 감사합니다. 이것은 이전에이 웹 사이트에서 사용 된 첫 번째 시간이었으며 귀하의 답변은시기 적절하고 도움이되었습니다. –