Question: Data Structures I need a full detailed description how you would solve the problem in JAVADOC!!!!! The code below works so I need a detailed

Data Structures
I need a full detailed description how you would solve the problem in JAVADOC!!!!! The code below works so I need a detailed description for it in JAVADOC format.
Polygon.java.
package shapes;
public interface Polygon {
double area();
double perimeter();
}
Triangle.java
package shapes;
public abstract class Triangle implements Polygon {
double x,y,z;
@Override
public abstract double area();
@Override
public abstract double perimeter();
}
class Isosceles extends Triangle{
Isosceles(double x,double y){
this.x = this.y = x;
this.z = y;
}
@Override
public double area() {
double altitude = Math.sqrt(x*y - z*z/4);
return altitude*this.z/2;
}
@Override
public double perimeter() {
return this.x+this.y+this.z;
}
@Override
public String toString() {
return "Isosceles [common side ="+this.x+" other side ="+this.z+"]";
}
}
class EquilateralTriangle extends Triangle{
EquilateralTriangle(double x){
this.x = this.y = this.z=x;
}
@Override
public double area() {
return Math.sqrt(3)*this.x*this.x/4;
}
@Override
public double perimeter() {
return this.x+this.y+this.z;
}
@Override
public String toString() {
return "EquilateralTriangle [side ="+this.x+"]";
}
}
Quadrilateral.java
package shapes;
public class Quadrilateral implements Polygon {
double x,y;
@Override
public double area() {
return x*y;
}
@Override
public double perimeter() {
return x+y;
}
}
class Rectangle extends Quadrilateral{
Rectangle(double x,double y){
this.x = x;
this.y = y;
}
@Override
public String toString() {
return "Rectangle [a="+this.x+" b = "+this.y+"]";
}
}
class Square extends Quadrilateral{
Square(double x){
this.x = this.y =x;
}
@Override
public String toString() {
return "Square [side="+this.x+"]";
}
}
Pentagon.java
package shapes;
public class Pentagon implements Polygon {
double size;
double noOfSide = 5;
Pentagon(double sizeIn){
size = sizeIn;
}
@Override
public double area() {
double angle = Math.toRadians(180oOfSide);
return size*size* noOfSide/(4*Math.tan(angle));
}
@Override
public double perimeter() {
return noOfSide*size;
}
@Override
public String toString() {
return "Pentagon [size="+size+"]";
}
}
Hexagon.java
package shapes;
public class Hexagon implements Polygon {
double size;
double noOfSide = 6;
Hexagon(double sizeIn){
size = sizeIn;
}
@Override
public double area() {
double angle = Math.toRadians(180oOfSide);
return size*size* noOfSide/(4*Math.tan(angle));
}
@Override
public double perimeter() {
return noOfSide*size;
}
@Override
public String toString() {
return "Hexagon [size="+size+"]";
}
}
Octagon.java
package shapes;
public class Octagon implements Polygon {
double size;
double noOfSide = 8;
Octagon(double sizeIn){
size = sizeIn;
}
@Override
public double area() {
double angle = Math.toRadians(180oOfSide);
return size*size* noOfSide/(4*Math.tan(angle));
}
@Override
public double perimeter() {
return noOfSide*size;
}
@Override
public String toString() {
return "Octagon [size="+size+"]";
}
}
Main.java
package shapes;
public class Main {
public static void main(String[] args) {
Isosceles isosceles = new Isosceles(20, 10);
System.out.println(isosceles);
System.out.println("Area : "+isosceles.area());
System.out.println("Perimeter : "+isosceles.perimeter());
System.out.println(" ");
EquilateralTriangle equilateralTriangle = new EquilateralTriangle(20);
System.out.println(equilateralTriangle);
System.out.println("Area : "+equilateralTriangle.area());
System.out.println("Perimeter : "+equilateralTriangle.perimeter());
System.out.println(" ");
Rectangle rectangle = new Rectangle(20,10);
System.out.println(rectangle);
System.out.println("Area : "+rectangle.area());
System.out.println("Perimeter : "+rectangle.perimeter());
System.out.println(" ");
Square square = new Square(20);
System.out.println(square);
System.out.println("Area : "+square.area());
System.out.println("Perimeter : "+square.perimeter());
System.out.println(" ");
Pentagon pentagon = new Pentagon(20);
System.out.println(pentagon);
System.out.println("Area : "+pentagon.area());
System.out.println("Perimeter : "+pentagon.perimeter());
System.out.println(" ");
Hexagon hexagon = new Hexagon(6);
System.out.println(hexagon);
System.out.println("Area : "+hexagon.area());
System.out.println("Perimeter : "+hexagon.perimeter());
System.out.println(" ");
Octagon octagon = new Octagon(6);
System.out.println(octagon);
System.out.println("Area : "+octagon.area());
System.out.println("Perimeter : "+octagon.perimeter());
System.out.println(" ");
}
}
Define a Polygon interface that has methods area) and perimeter). Then im- plement classes for Triangle, Quadrilateral, Pentagon, Hexagon, and Octagon, which implement this interface, with the obvious meanings for the area) and perimeter() methods. Also implement classes, Isosceles Triangle, Equilateral- Triangle, Rectangle, and Square, which have the appropriate inheritance rela- tionships. Finally, write a simple user interface, which allows users to create polygons of the various types, input their geometric dimensions, and then out- put their area and perimeter. For extra effort, allow users to input polygons by specifying their vertex coordinates and be able to test if two such polygons are Similar. 1. Algorithm/Documentation: detailed description how you would solve the problem in javadoc format. 2. Implementation: The actual code that implementing your solution. The implementation should follow your documentation precisely The documentation should be embedded into the implementation (java files)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
