Question: in java need urgent Q2. You are given the following classes Shape(abstract). Rectangle. Ellipse. Triangle, Square. Circle and Sphere. The inheritance diagram is as follows:

in java need urgent
Q2. You are given the following classes Shape(abstract). Rectangle. Ellipse. Triangle, Square. Circle and Sphere. The inheritance diagram is as follows: (20) Shape post souble double Volume double Rectangle th: widos resolve double Volume) dotte Triangle DETTE sident sident wall deute Printer: double wounelliduble Ellipse -radius dzint A double Per double Vorridore Square Circle all double Perindo tiraali dtunl| parter: double Vlado Sphere a double Perimet doule Volumalli double Complete the main) method in the TestShapes class to 1) Declare an ArrayList with initial capacity of 1000 Shape references 2) Generate randomly 1000 objects of Rectangle Triangle. Square Ellipse and Circle objects that will be referred by the Shape references 3) Calculate and print the total perimeter of the Triangle objects 4) Calculate and print the total area of the Rectangle objects. 5) Calculate and print the total volume of the Sphere objects 6) Print the number of objects of each geometric shape available 7) Sort the objects based on the Euclidean distance (ED) ED = t_coord? +y_coord? Hint: Implement the Comparator interface in a class called EuclideanDistance Cumparator to sort the amay objects using the Euclides distance defined above. 8) Print the smallest element according to the ED measure 9) Print the largest element according to the ED measure
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
