public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
int sides = scanner.nextInt();
double length = scanner.nextDouble();
RegularPolygon(sides, length);
}
public static void RegularPolygon(int side, double length)
{
double area = 0;
double perimeter = 0;
String shape;
String sentence;
for(int i = 0; i <= side; i++)
{
perimeter = length*side;
area = side * (length * length) / (4.0 * Math.tan(Math.PI / side));
}
switch (side)
{
case 1:
shape = "Line";
System.out.println("There is no ability for area or perimeter.");
break;
case 2:
shape = "Angle";
System.out.println("There is no ability for area or perimeter.");
break;
case 3:
shape = "Triangle";
sentence= "A regular " + shape +" with a side length of " + length +" has a perimeter " + perimeter + " " + "and an area of " + area;
System.out.println(sentence);
break;
case 4:
shape = "Square";
sentence= "A regular " + shape +" with a side length of " + length +" has a perimeter " + perimeter + " " + "and an area of " + area;
System.out.println(sentence);
break;
case 5:
shape = "Pentagon";
sentence= "A regular " + shape +" with a side length of " + length +" has a perimeter " + perimeter + " " + "and an area of " + area;
System.out.println(sentence);
break;
case 6:
shape = "Hexagon";
sentence= "A regular " + shape +" with a side length of " + length +" has a perimeter " + perimeter + " " + "and an area of " + area;
System.out.println(sentence);
break;
case 7:
shape = "Heptagon";
sentence= "A regular " + shape +" with a side length of " + length +" has a perimeter " + perimeter + " " + "and an area of " + area;
System.out.println(sentence);
break;
case 8:
shape = "Octagon";
sentence= "A regular " + shape +" with a side length of " + length +" has a perimeter " + perimeter + " " + "and an area of " + area;
System.out.println(sentence);
break;
case 9:
shape = "Nonagon";
sentence= "A regular " + shape +" with a side length of " + length +" has a perimeter " + perimeter + " " + "and an area of " + area;
System.out.println(sentence);
break;
case 10:
shape = "Decagon";
sentence= "A regular " + shape +" with a side length of " + length +" has a perimeter " + perimeter + " " + "and an area of " + area;
System.out.println(sentence);
break;
case 11:
shape = "Hendecagon";
sentence= "A regular " + shape +" with a side length of " + length +" has a perimeter " + perimeter + " " + "and an area of " + area;
System.out.println(sentence);
break;
case 12:
shape = "Dodecagon";
sentence= "A regular " + shape +" with a side length of " + length +" has a perimeter " + perimeter + " " + "and an area of " + area;
System.out.println(sentence);
break;
}
}