Question: Computer Science Department (Laboratory Work Book for Comp231) 36 2. Implement the superclass Shape and its subclasses Circle, Rectangle and Square as shown in the

Computer Science Department (Laboratory Work Book for Comp231) 36 2. Implement the superclass Shape and its subclasses Circle, Rectangle and Square as shown in the following UML class diagram, note that the compare To method will compare based on area: > Comparable implements > Shape #color: String #filled: boolean + Shapel + Shape(color: String.filled: boolean) + getColor(): String +setColor(color: String): void *getFilled(): boolean + setFilled(filled: boolean); void +toString(): Sring +getAreal): double extends extends Circle Rectangle #radius: double #width: double #length: double +Circle +Circle(radius: double, color: String, filled:boolean) +Rectangle +Rectangle{ width: double, length: double) -getRadius(): double +setRadius(radius: double): void +getWidth: double -setWidth(width: double): void getLength: double setLength( length: double): void Create an array list of 5 different shapes, then sort the list and print the type of each object with its area
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
