Cannot resolve symbol error. Please HELP!

Here is the error I have been receiving.  If someone could help me with this it would be greatly appreciated.

C:\Java\compositionCube.java:16: cannot resolve symbol
symbol  : method setDepth (double)
location: class compositionCube
      setDepth( side );
        ^
1 error

Tool completed with exit code 1

public class compositionCube
{
private double depth;
private compositionSquare square;

public compositionCube()
{
      this( 0.0, 0, 0);
}


public compositionCube( double side, int x, int y )
{
      square = new compositionSquare( side, x, y );
      setDepth( side );
}

public double area()
{
      return square.area() * 6;

}

//ACCESS FOR DEPTH
public double getDepth()
{
      return depth;

}

//GET SHAPE NAME
public String getName()
{
      return "Cube";
}

//ACCESSOR TO SQUARE'S VALUE FOR AREA
public double getSquareArea()
{

      return square.area();

}

//ACCESSOR TO SQUARE'S NAME
public String getSquareName()
{
      return square.getName();

}

//ACCESSOR TO SQUARE'S ACCESSOR TO POINT'S NAME
public String getSPointName()
{
      return square.getPointName();
}

//ACCESSOR TO SQUARE'S ACCESSOR TO POINT'S STRING VALUE
public String getSPointString()
{
      return square.getPointString();

}

//ACCESSOR TO SQUARE'S STRING VALUE
public String getSquareString()
{
      return square.toString();

}

//RETURN A STRING DESCRIBING THE CUBE
public String toString()
{
return square.toString() + "; Depth = " + depth;
}

//CALCULATE VOLUME
public double volume()
{
return square.area() * depth;
}
}
brassmonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
There is no setDepth method defined in your class
0
CEHJCommented:
public void setDepth(double depth)
{
     this.depth = depth;
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mick BarryJava DeveloperCommented:
If you only need it in your ctor (which appears to be the case) then just set your depth variable directly.

public compositionCube( double side, int x, int y )
{
     square = new compositionSquare( side, x, y );
     this.side = side;
}

Though I'd question whether you even need to store depth as it is already stored in your square. You could instead do:

public class compositionCube
{
private compositionSquare square;

public compositionCube()
{
     this( 0.0, 0, 0);
}


public compositionCube( double side, int x, int y )
{
     square = new compositionSquare( side, x, y );
}

public double area()
{
     return square.area() * 6;

}

//ACCESS FOR DEPTH
public double getDepth()
{
     return square.getSide();

}

//GET SHAPE NAME
public String getName()
{
     return "Cube";
}

//ACCESSOR TO SQUARE'S VALUE FOR AREA
public double getSquareArea()
{

     return square.area();

}

//ACCESSOR TO SQUARE'S NAME
public String getSquareName()
{
     return square.getName();

}

//ACCESSOR TO SQUARE'S ACCESSOR TO POINT'S NAME
public String getSPointName()
{
     return square.getPointName();
}

//ACCESSOR TO SQUARE'S ACCESSOR TO POINT'S STRING VALUE
public String getSPointString()
{
     return square.getPointString();

}

//ACCESSOR TO SQUARE'S STRING VALUE
public String getSquareString()
{
     return square.toString();

}

//RETURN A STRING DESCRIBING THE CUBE
public String toString()
{
return square.toString() + "; Depth = " + getDepth();
}

//CALCULATE VOLUME
public double volume()
{
return square.area() * getDepth();
}
}
0
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

jimmackCommented:
brassmon.  I've already answered this for you too.  Please read my comments on your previous posting 10/31/2003

http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20784472.html

>>It doesn't compile (for the following reasons):
>>
.
.
.
>>2) Again the the compositionCube constructor, this class doesn't have a setDepth method.
>>
>>        depth = side;
0
jimmackCommented:
CEHJ and objects - sorry to chop in again.  I'm not sure why brassmon hasn't responded to the solution I posted in the above reference.

Jim.
0
Mick BarryJava DeveloperCommented:
Storing depth as a member variable is redundant anyway, and probably should be removed as I outlined above.
0
jimmackCommented:
Hi objects ;-)  That's fair comment (and I confess, I didn't read your full posting :-( )

I'm just a bit concerned that brassmon has asked three such closely related questions, but doesn't seem to be commenting on the responses.
0
Mick BarryJava DeveloperCommented:
> I'm just a bit concerned that brassmon has asked three such closely
> related questions, but doesn't seem to be commenting on the
> responses.

Happens all the time :)

0
jimmackCommented:
I hope this doesn't happen all the time objects :-(

I must confess, although I'm unhappy about not getting the points, I'm almost as keen to see you hit 1,000,000 as I am to get my first certification level at Master.

Almost ;-)


CEHJ: You.. you.. you.. points absorber, you.

;-)
0
jimmackCommented:
This is nagging at me, so objects and CEHJ, can I ask your advice?

The last thing I want to do is upset either of you.  You both know your stuff (*big time*) and you have both provided good answers.  What would you both do in this situation?

I'll swallow the bitter pill ;-) I just feel a bit short changed :-(
0
CEHJCommented:
If you've answered the question elsewhere the points may well come your way in good time - one way or another
0
Mick BarryJava DeveloperCommented:
Even worse when the wrong answer gets accepted.
0
jimmackCommented:
Well, thanks for your comments (I think).

CEHJ: Are you implying that you will take action on this or is this a reference to "all good things to he who waits"?

objects: Is this a general comment or are you implying that I've had an answer accepted when it should have been yours?

As I said, I'm not here to upset anyone, I'm here to help - where I can.

So... If I've done something wrong, tell me so I don't do it again.  If you're both happy with the way the points were handled, tell me so I know where I stand.

Thanx.

Jim.
0
CEHJCommented:
>>
CEHJ: Are you implying that you will take action on this or is this a reference to "all good things to he who waits"?
>>

The latter. I'm unaware of your previous history elsewhere with this question. As far as the question is concerned here, the problem, and the solution, which I gave, were both very clear.
0
jimmackCommented:
Thanks CEHJ.  So long as I know, I'm OK with it :-)
0
Mick BarryJava DeveloperCommented:
> Is this a general comment or ...

Just a general comment :)

> If you're both happy with the way the points were handled

How the points are handled is up to the asker. We are just here to provide answers.
0
Mick BarryJava DeveloperCommented:
> and the solution, which I gave, were both very clear.

Though a little error-prone as a call to setDepth() may result in the cube no longer being a cube ;)

0
jimmackCommented:
Thanx objects.  Same applies again:

>> So long as I know, I'm OK with it :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.