That puts you back to square one.
You say you must use "distance[index] = fillup[index].calcDistance();", but calcDistance() is a void method (does not return anything). Under those conditions...
Type: Posts; User: pbrockway2
That puts you back to square one.
You say you must use "distance[index] = fillup[index].calcDistance();", but calcDistance() is a void method (does not return anything). Under those conditions...
Shouldn't you be saying something like fillup[index].calcDistance();
Yes, I know! you did say that. But do both. First fillup[index].calcDistance(); then whatever=fillup[index].getDistance();
I'm just guessing about the triangle example, but I imagine it would be along the lines of:
public class RightTriangle
{
private double myArea;
private double mySide1;
Yes calcDist() will correctly calculate the distance. But you have to call this method.
You have to call calcDist() to calculate the distance. And then you can use getDistance() to get the...
That's why I suggested thinking about how getDistance() might be used ;)
getDistance() will return something, so that's good. But you still have to calculate the distance. Have a look at the...
The incompatible types message occurs because you call calcDistance() which is a void method. That is, it does not return anything. But you try and assign the result to distance[index]. You can't...