Question: Write a ONE java program to implement the following requirements: Design 3 classes: Shape8, Circle8, Square8 as below Shape8 is an abstract class . ComputeData

Write a ONE java program to implement the following requirements: Design 3 classes: Shape8, Circle8, Square8 as below Shape8 is an abstract class . ComputeData is an interface Italicized methods mean abstract methods ComputeData +getDiagonal (): double note: diagonal Math.sqrt(width width 2) Shape8 color:String -area: double +Shape8(Sring color) +getArea O:double + setArea (area: double):void +getColorO:String +compareto(o: Shape8): int toStringO: Strin Circle8 -radius: double +Circle8(color: String, radius: double) +toString0: String are width: double +Square8( color: String. width: double) +toString0: String necessary methods note: area-width width necessary methods note: area radius radius Math.PI 1. The program should be named: xxxx Lab8.java(xxxx is your email ID). 2. Implement the necessary methods for each class. 3. The test class xxxxx Lab8 should have a main() method that will call three methods: readData(), sort), report0) 4. readData() method will take 3 input records from keyboard, the input formats are as below (color, radius or width, type) For example: blue 10 circle yellow 5.5 square red 5 circle Use a Shape8 array to hold these objects. If the type is circle, create a Circle8 object to hold the data. If the type is square, create a Square8 object to hold the data. 5. 6. sort() method will sort the three objects' areas from low to high. 7. report) method will print the sorted objects with the following information: color, area and radius for circle object. b. a. color, area, width, and diagonal for square object. 8. The above test data should have the following output: Color yellow, Area: 30.25, Width:5.5, Diagonal: 7.7781 745930520225 Color: red, Area: 78.53981633974483, Radius: 5 Color: blue, Area: 314.1592653589793, Radius: 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
