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 ellipsoidList; private

public class EllipsoidList { private String list; private ArrayList ellipsoidList; private ArrayList ellipsoids = new ArrayList(); public ArrayList readFile(String filename) throws FileNotFoundException { Scanner input = new Scanner(new File(filename)); ArrayList list = new ArrayList(); while (input.hasNextLine()) { String line = input.nextLine(); String[] parts = line.split(","); String label = parts[0]; double a = Double.parseDouble(parts[1]); double b = Double.parseDouble(parts[2]); double c = Double.parseDouble(parts[3]); list.add(new Ellipsoid(label, a, b, c)); } input.close(); ellipsoidList = new ArrayList(); return list; } public void addEllipsoid(String name, double a, double b, double c) { Ellipsoid e = new Ellipsoid(name, a, b, c); ellipsoids.add(e); }

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 ellipsoidListIn) { list = listIn; ellipsoidList = new ArrayList(); for (Ellipsoid e : ellipsoidListIn) { ellipsoidList.add(e); } }

//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: ArrayList cannot be converted to EllipsoidList E11ipsoidtist actual = list. readfile(filenamee); Project/Proj6tests.java:1161: error: incompatible types: ArrayList cannot be converted to EllipsoidList E1lipsoidtist actual = list. readfile(filename1); Project/Proj6tests.java:1176: error: incompatible types: ArrayList cannot be converted to E11ipsoidList Ellipsoidtist actual = list.readfile(serectFilename); 3 errors

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!