CSC285 Problem 1 Java Data Structures Programming I attached the question. I need the code o the programe Spring 2019
CSC 285 Prob 1
Write a program that will create a set of objects called Solids. The objects should be of five types,
Cubes, Spheres, Cones, Parallelepipeds (Brick), Truncated Cones. Create a base class called Solids which
will contain the following data values and functionality.
protected int len;// the length of the solid
protected int wid;// the width of the solid
protected int hig;// the height of the solid
protected double area;// the surface area of the solid
protected double volume;// the volume of the solid
In cases where the solid has only one dimension (i.e. sphere, the len, wid, and hig will all be the same).
Solids Functionality. Each solid must be able to do the following;
public void calcvol(); // calculates volume
public void calcarea();// calculates area
public double getvol();//returns volume
public double getarea();// returns area
public void printsolid(); // prints the solid to include its name, major dimensions, area and
Use the equations provided on the extra sheet to calculate the area and volume of solids.
Create an abstract class, call it class Shapes. Abstract class Shapes must have at least three abstract
functions. At the class level Solids add a compare to function that compares the area of the solids in the
sub classes Cubes, Spheres, Cones, Parallelepipeds and TCones. Then use your compareTo capability to
do the following;
Create an array called MySolids of type Solids. Then create the following solids and store them in the
Cones(5,6,6) 5 is radius, 6 is height
Cones(3,12,12) 3 is radius, 12 is height
TCones(5,6,3) 5 is radius 1,6 is height , 3 is radius 2
TCones((8,4,6) 8 is radius 1, 4 is height, 6 is radius 2
Then preform the following actions.
Calculate the area and volume of all solids using array MySolids
Print each solid using the array MySolids
Calculate and print the total area and total volume of all solids
Find and print the object with Maximun area.
Find and print the object with Minimun volume.
Sort the array MySolids based on volume (from larger to smaller) and print the array.
20 Points Due 31 Jan.
Purchase answer to see full