Question: My EllipsoidList.java cannot compiled. I get the following message: EllipsoidList.java:247: error: cannot find symbol and EllipsoidList.java:250: error: incompatible types: boolean cannot be converted to Ellipsoid.
My EllipsoidList.java cannot compiled. I get the following message: EllipsoidList.java:247: error: cannot find symbol and EllipsoidList.java:250: error: incompatible types: boolean cannot be converted to Ellipsoid. Also compile error is connected to:
if (e != null) { e.setA(aIn); e.setB(bIn); e.setC(cIn); return true; } return false; } }
Please let me know what I am missing. EllipsoidList code below.
import java.text.DecimalFormat; import java.util.ArrayList; import java.io.FileNotFoundException; import java.util.Scanner;
/** Program that uses the ArrayList to find a summary of an Ellipsoid. * * @Author: Ronald Funes * @version: 02/28/2023 */ public class EllipsoidList { private String list; private ArrayList
/** * counts the total. * @return totalSurfaceArea */ public double totalSurfaceArea() { double total = 0; for (Ellipsoid e : ellipsoidList) { if (e != null) { total += (e.surfaceArea()); } } return total; } /** * finds volume. * @return averageVolume */ public double averageVolume() { if (this.numberOfEllipsoids() == 0) { return 0; } else { return this.totalVolume() / this.numberOfEllipsoids(); } }
/** * finds surface area. * @return averageSurfaceArea */
public double averageSurfaceArea() { if (this.numberOfEllipsoids() == 0) { return 0; } else { return this.totalSurfaceArea() / this.numberOfEllipsoids(); } } /** Gets summary and finds string. * @return summaryInfo */ public String toString() { String result = getName() + " "; int index = 0; while (index < ellipsoidList.size()) { result += " " + ellipsoidList.get(index) + " "; index++; } return result; }
/** Gets result of ellipsoid and states summary. * @return summaryInfo */ public String summaryInfo() { DecimalFormat df = new DecimalFormat("#,##0.###"); String result = ""; result += " "; result += "----Summary for " + getName() + "----"; result += " Number of Ellipsoid Objects: " + numberOfEllipsoids(); result += " Total Volume: " + df.format(totalVolume()) + "cubic units"; result += " Total Surface Area: " + df.format(totalSurfaceArea()) + "square units"; result += " Average Volume: " + df.format(averageVolume()) + "cubic units"; result += " Average Surface Area: " + df.format(averageSurfaceArea()) + "square units"; return result; } /** Uses ArrayList to return the ellipsoidList. * @return ellipsoidList */ public ArrayList
public void addEllipsoid(String label, double a, double b, double c) { ellipsoidList.add(new Ellipsoid(label, a, b, c)); } /** New method added. * @param label used * @return null if not found */ public Ellipsoid findEllipsoid(String label) { for (Ellipsoid e : ellipsoidList) { if (e.getLabel().equalsIgnoreCase(label)) { return e; } } return null; } /** Delete the ellipsoid method. * @param label used * @return e for Ellipsoid */ public Ellipsoid deleteEllipsoid(String label) { Ellipsoid e = findEllipsoid(label); if (e != null) { ellipsoidList.remove(e); } return e; } /** Edits the ellipsoid. * @param a as part of editEllipsoid * @param b as part of editEllipsoid * @param c as part of editEllipsoid * @return boolean */ public Ellipsoid editEllipsoid(String a, double b, double c) { Ellipsoid e = editEllipsoid(a, b, c); if (e != null) { e.setA(aIn); e.setB(bIn); e.setC(cIn); return true; } return false; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
