Question: Using java add comments please 1. (60 pts) Implement hierarchy shown below. Shape Rectangle Triangle .Shape is an abstract class including two private instance variables:
1. (60 pts) Implement hierarchy shown below. Shape Rectangle Triangle .Shape is an abstract class including two private instance variables: height and width, a constructor, set and get methods (height and width must be greater tharn 0, otherwise throw IllegalArgumentException), toString method, and an abstract method called getArea. .The class rectangle has one private instance variable: color, a constructor, set and The class Triangle has one private instance variable: classification (for example; . Create a test file named ShapeTest. Create one object from the classes Rectangle get, toString, and getArea methods. equilateral), a constructor, set and get, toString, and getArea methods. and Triangle. Then, create an array of Shape references to objects of each subclass in the hierarchy Then, create an enhanced for loop that processes all the shapes in the array. If the object belongs to class Triangle, display a message that the object is a Triangle. If the object belongs to class Rectangle, display a message that the object is a Rectangle. UPLOAD Shape.java Rectange.java Triangle.java ShapeTest.java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
