Question: The program has to be programmed in java please and thank you . Here is the question and the classes will be given then the
The program has to be programmed in java please and thank you . Here is the question and the classes will be given then the instructions for the second part of the assignment thanks.

Shape class
public abstract class Shape{ public abstract double getArea(); public abstract double getPerimeter();
}//End class Shape
Equilltriangle class
public class EquilTriangle extends Shape{ private double length; public EquilTriangle(double lengthIn){ length = lengthIn; } public String toString(){ return "[Equilateral Triangle: Length: "+length+"]"; } public double getArea(){ double h = length; double o = length/2; return Math.sqrt(h*h-o*o); } public double getPerimeter(){ return length*3; }
}//End class EquilTriangle
Cirlce class.
public class Circle extends Shape{ private double radius; public Circle(double radiusIn){ radius = radiusIn; } public String toString(){ return "[Circle: radius: "+radius+"]"; } public double getArea(){ return Math.PI*radius*radius; } public double getPerimeter(){ return Math.PI*2*radius; }
}//End class Circle
Square class
public class Square extends Shape{ private double length; public Square(double lengthIn){ length = lengthIn; } public String toString(){ return "[Square: Length: "+length+"]"; } public double getArea(){ return length*length; } public double getPerimeter(){ return 4*length; }
}//End class Square
Test class.
public class Test1 { public static void main(String[] args){ // Create several shapes with two that // have the same perimeter and two references // that share the same object. Circle cA = new Circle(2); Circle cB = cA; Circle cC = new Circle(2); Circle cD = new Circle(3); Square sA = new Square(Math.PI); EquilTriangle tA= new EquilTriangle(2); System.out.println("cA.equals(cB): "+cA.equals(cB) ); System.out.println("cA.equals(cC): "+cA.equals(cC) ); System.out.println("cA.equals(cD): "+cA.equals(cD) ); System.out.println("cA.equals(sA): "+cA.equals(sA) ); System.out.println("tA.equals(sA): "+tA.equals(sA) ); } }//End Test1


Here are the questions at the end I would like them to be answered as well in order thanks.

Please program all of this in java since it is given to you in java please and thank you.
1. Inheritance and Polymorphism: Use the given classes (Shape, EquilTriangle, Circle, Square) and the driver program Testi: A. Run the program using the given "hard-coded" data. What is the result of using the equals() method of the base Object class? How is it determining equality? Report the results. B. Write an equals() method for EquilTriangle, Circle and Square that determines equal based on the shape's area (What class should it go in?). Run the Testi program again and report the results. C. Create a Test2 driver class to hold the following shapes in an array, compare each shape against the others (only once) using your equals() method and report the results. new Circle (2); new Circle (2); new Circle (3); new Square (Math.PI); new EquilTriangle (2); 2. Interfaces and Polymorphism: A. Implement the Comparable interface for the various shapes where the compareTo() method uses the value of perimeter/area as the basis for comparison. Implement in Find.java the following methods using one of the following two ways to handle generic types: 1. As in the textbook (see the Sorting class in Chapter 10): public class Find
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
