Question
public class EllipsoidList { private String list; private ArrayList ellipsoidList; private ArrayList ellipsoids = new ArrayList (); public ArrayList readFile(String filename) throws FileNotFoundException { Scanner
public class EllipsoidList { private String list; private ArrayList
public Ellipsoid findEllipsoid(String name) { for (Ellipsoid e : ellipsoids) { if (e.getName().equalsIgnoreCase(name)) { return e; } } return null; }
public Ellipsoid deleteEllipsoid(String name) { for (int i = 0; i
public Ellipsoid editEllipsoid(String name, double a, double b, double c) { for (int i = 0; i getList() { return ellipsoidList; }
/** * Create a EllipsoidList object. * @param listIn for listName * @param ellipsoidListIn for ellipsoidList */ public EllipsoidList(String listIn, ArrayList
//methods /** * @return the list name */ public String getName() { return list; }
/** * @return the list name */ public int numberOfEllipsoids() { return ellipsoidList.size(); }
/** * @return the list name */ public double totalVolume() { double total = 0; //use for each loop for (Ellipsoid e : ellipsoidList) { if (e != null) { total += (e.volume()); } } // return the total volume return total; }
/** * counts the total. * * @return totalSurfaceArea */ public double totalSurfaceArea() { double total = 0; //use for each loop for (Ellipsoid e : ellipsoidList) { if (e != null) { total += (e.surfaceArea()); } } return total; }
/** * finds. * * @return averageVolume */ public double averageVolume() { if (this.numberOfEllipsoids() == 0) { return 0; } else { return this.totalVolume() / this.numberOfEllipsoids(); } }
/** * finds. * * @return averageSurfaceArea */ public double averageSurfaceArea() { if (this.numberOfEllipsoids() == 0) { return 0; } else { return this.totalSurfaceArea() / this.numberOfEllipsoids(); } }
/** * gets a summary of the ellipsoid in the list. * * @return summaryInfo */ public String toString() { String result = getName() + " "; int index = 0; while (index
/** * gets a summary of the ellipsoid in the list. * * @return summaryInfo */
public String summaryInfo() { DecimalFormat decFt = new DecimalFormat("#,##0.###"); String result = ""; result += " "; result += "----- Summary for " + getName() + "-----"; result += " Number of Ellipsoid Objects: " + numberOfEllipsoids(); result += " Total Volume: " + decFt.format(totalVolume()) + " cubic units"; result += " Total Surface Area: " + decFt.format(totalSurfaceArea()) + " square units"; result += " Average Volume: " + decFt.format(averageVolume()) + " cubic units"; result += " Average Surface Area: " + decFt.format(averageSurfaceArea()) + " square units"; return result; }
}
Your code failed to compile correctly against the reference tests. This is most likely because you have not named your class(es) as required in the assignment, have failed to provide one or more required methods, or have failed to use the required signature for a method. Failure to follow these constraints will prevent the proper assessment of your solution and your tests. The following specific error(s) were discovered while compiling reference tests against your submission: Project/Proj6tests.java:1146: error: incompatible types: ArrayListStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started