Question: edit Ellipsoid : Takes four parameters ( label, a, b, and c ), uses the label to find the corresp onding the Ellipsoid object .
edit
Ellipsoid
: Takes
four
parameters (
label,
a, b, and
c
), uses the label to find the
corresp
onding the
Ellipsoid
object
. If found, sets the
a, b, and c
to the values passed in as
parameters, and returns
the Ellipsoid object
. If not found, returns
null
.
This method
should
not
change the label
.
public boolean editEllipsoid(String labelIN, double aIN, double bIN, double cIN) { Ellipsoid result = null; int index = 0; for (Ellipsoid h : tList) { if (h.getLabel().equalsIgnoreCase(labelIN)) { index = tList.indexOf(h); break; } } if (index >= 0) { findEllipsoid(labelIN).setA(aIN); findEllipsoid(labelIN).setB(bIN); findEllipsoid(labelIN).setC(cIN); return true; } return false; }
my reviewer program says
error: incompatible types: boolean cannot be converted to Ellipsoid Ellipsoid actual = list.editEllipsoid("abcdefg", 1,2,3);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
