interface RegularPolygon {
int getNumSides();
double getSideLength();
static int totalSides(RegularPolygon[] rpArray) {
}
default double getPerimeter() {
}
default double getInteriorAngle() {
}
}
class EquilateralTriangle implements RegularPolygon {
private double sideLength;
public EquilateralTriangle(double sideLength) {
}
public int getNumSides() {
}
public double getSideLength() {
}
public String toString() {
}
}
class Square implements RegularPolygon {
private double sideLength;
public Square(double sideLength) {
}
public int getNumSides() {
}
public double getSideLength() {
}
public String toString() {
}
}
public class Main {
public static void main(String[] args) {
Scanner con = new Scanner(System.in);
int n = con.nextInt();
RegularPolygon[] rpArray = new RegularPolygon[n];
...
con.close();
}
}Write a program that meets the following requirements:
Create an interface named RegularPolygon with two abstract methods: getNumSides and getSideLength.
Create a class EquilateralTriangle that implements the interface. This class should have getNumSides return 3 and getSideLength return a value set by the constructor.
Create a class Square that implements the interface. This class should have getNumSides return 4 and getSideLength return a value set by the constructor.
Add a static method totalSides to the interface, which, given a RegularPolygon[], returns the sum of the number of sides of all figures.
Add two default methods:
getPerimeter (n * length, where n is the number of sides)
getInteriorAngle ((n - 2)π / n in radians)
The first line contains an integer (n \leq 100), the number of geometric figures. Each of the next lines contains the name of the figure (Triangle or Square) and its side length (a real number).
For each figure, print its name, side length, perimeter, and the value of its interior angle, formatted as in the sample output. In the last line, print the total number of sides among all figures.

Example 1