Hello I am new at java and haven't worked with lists. I need to find the maximum value of the 3 classes and print it out. Here is my code so far I don't know if I am way out of track but I did my best.
package com.emir;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
public class Shape {
public static Shape getShapeWithMaxvolume(List<Float> shapes) {
Cone cone = new Cone(15,11);
Cylinder cylinder = new Cylinder(12,5);
Cuboid cuboid = new Cuboid(15,2,1);
shapes.add(cone.getSum());
shapes.add(cylinder.getSum());
shapes.add(cuboid.getSum());
for(int i = 0; i <shapes.size();i++){
Collections.sort(shapes);
System.out.println("The max value is " + shapes.get(i));
}
return null;
}
}
Please help I am on a deadline with this one. or at least offer advice. for the geometric shapes, I extended from Shape (this class) I made a private variable sum to calculate the volume of the particular shape and made getter and setter for all of the shapes.