Question: Shapes In this problem, you are provided with a Shape class and will need to create the other four classes shown in the following class

 Shapes In this problem, you are provided with a Shape classand will need to create the other four classes shown in thefollowing class hierarchy. Each shape object has one (x,y) coordinate that anchorsit in the xy plane. This anchor point is fixed and cannotchange once an object is created. The other parameters can change though.The provided XYCoord class is used to store (x,y) coordinates. All shapesmust be able to compute their own area and perimeter 1 in

Shapes In this problem, you are provided with a Shape class and will need to create the other four classes shown in the following class hierarchy. Each shape object has one (x,y) coordinate that anchors it in the xy plane. This anchor point is fixed and cannot change once an object is created. The other parameters can change though. The provided XYCoord class is used to store (x,y) coordinates. All shapes must be able to compute their own area and perimeter 1 in addition to specific methods (outlined below). You are free to add any state to your classes as needed but you should not be storing information twice. Each of the classes will have a constructor that is appropriate for the particular shape detailed as follows: public Quadrilateral (XYCoord a, XYCoord b, XYCoord c, XYCoord d) // a quadrilateral has four straight sides and four corner points (vertices) // the corner points are specified by the inputs a,b, c,d // a is the anchor coordinate for this shape. public Square(XYCoord anchor, double length) // a square is a special quadrilateral (all sides have the same // length and the angle at each corner is 90 degrees). // the anchor is the bottom-left corner of the square and length >=0 public Triangle(XYCoord a, XYCoord b, XYCoord c) // a,b, are the three coordinates of the corners (vertices) of the triangle // a is the anchor coordinate for this shape public Circle(XYCoord centre, double radius) // centre is the anchor coordinate and radius >=0 1 The word circumference is usually used circle and shapes with curves but we will use perimeter for everything You will also need to create the following setter methods in the specified classes. Note that there is no setter for the Quadrilateral class.: Circle Class public void setRadius (double newRadius) // changes the object's radius to be newRadius Triangle Class public void setBC (XYCoord newB, XYCoord newC) // changes the object's b and c points to be newB and newC Square Class public void setLength (double newLength) // changes the object's length to be newLength You can use the provided ShapeExampleApp to help test your code. Do NOT change or submit the provided Shape.java file. Do NOT change or submit the provided XYCoord.java file. When testing, we will use the files as provided (and delete any version you submit). The area for the square and circle should be straightforward to compute. For the quadrilateral, note that you can think of this shape as being composed of two triangles next to each other. For a triangle, you might find the following resource helpful: https://byjus.com/maths/ area-of-a-triangle/ Include your Quadrilateral. java, Square. java, Triangle.java and Circle.java files in your .zip when you submit. Note that the shapes will always be created with coordinates as shown below. That is, the ordering of the coordinates will correspond to the labelling on the diagrams. ublic class ShapeExampleApp \{ private static double epsilon =0.0000001 I/ private helper methods for the program private static boolean eq(double x double y ) return Math. abs (xy)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!