Question

edit Ellipsoid : Takes four parameters ( label, a, b, and c ), uses the label...

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);

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ellipsoid Ellipsoid actual = list.editEllipsoid("abcdefg", 1,2,3);

See, for this line to work correctly, your editEllipsoid method must return an ellipsoid, as you've declared it as the datatype of the object.

But what you have actually done in the editEllipsoid method is to return a boolean value, as I can see in your code. So, you would most probably have to make a different method that constructs an ellipsoid.

And I can do that for you, but only if I have the complete information about what you are trying to do. So, please explain what do you want this code to do, also you've used a function findElipsoid(), and you've not made that in your code. What do you intend to do with that.

So, either post a new question properly explaining the whole thing, including the functions that you want. Or comment on this answer as to what you are trying to do. Also, what does that label do specifically, and why is it required for the ellipsoid. Help me so that I can help you.

Add a comment
Know the answer?
Add Answer to:
edit Ellipsoid : Takes four parameters ( label, a, b, and c ), uses the label...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is a java file and I am very confused on how to do this project!...

    This is a java file and I am very confused on how to do this project! please help!! Specifications Overview: You will write a program this week that is composed of three classes: the first class defines Ellipsoid objects, the second class defines EllipsoidList objects, and the third, Ellipsoid ListApp, reads in a file name entered by the user then reads the list name and Ellipsoid data from the file, creates Ellipsoid objects and stores them in an ArrayList of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT