私は、ペンタゴンの半径をとって一面に変えて出力するコードを書こうとしていました。道のりのどこかで、私の数学クラスの使用は間違っています。 (このサイトは初めてしかし、あなたは私のプログラムを理解できるように、すべてのものをフォーマットしようとした)ペンタゴンのエリア
Class: CS 1301/16
// Term: Fall
// Name: Gabriel Tomasetto
// Intsructor: Ms. Tulin
// Assignment 1
import java.util.*;
public class Pentagon {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
double radius, side, area;
System.out.println("Please enter the length of the Pentagon from the center to the vertex: ");
radius = scan.nextDouble();
side = (2 * radius) * (Math.sin(Math.PI/5)); //I'm assuming I'm not correctly using the Math class to represent the equation? Thoughts.
area = (5 * Math.pow(radius, 2))/(4 * Math.tan(Math.PI /5));
System.out.println("The area of the Pentagon is:\t" + area);
}
}
間違って出力されたと仮定すると、すべてがコンパイルされ、正常に動作。 –