[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Cannot resolve symbol error. Please HELP!

Posted on 2003-11-02
18
Medium Priority
?
522 Views
Last Modified: 2010-03-31
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;
}
}
0
Comment
Question by:brassmon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
  • 4
18 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 9667071
There is no setDepth method defined in your class
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 9667079
public void setDepth(double depth)
{
     this.depth = depth;
}
0
 
LVL 92

Expert Comment

by:objects
ID: 9667311
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:jimmack
ID: 9667442
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
 
LVL 15

Expert Comment

by:jimmack
ID: 9667446
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
 
LVL 92

Expert Comment

by:objects
ID: 9667468
Storing depth as a member variable is redundant anyway, and probably should be removed as I outlined above.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9667530
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
 
LVL 92

Expert Comment

by:objects
ID: 9667547
> 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
 
LVL 15

Expert Comment

by:jimmack
ID: 9670116
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
 
LVL 15

Expert Comment

by:jimmack
ID: 9670172
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 9670826
If you've answered the question elsewhere the points may well come your way in good time - one way or another
0
 
LVL 92

Expert Comment

by:objects
ID: 9674679
Even worse when the wrong answer gets accepted.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9674900
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 9674918
>>
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
 
LVL 15

Expert Comment

by:jimmack
ID: 9674933
Thanks CEHJ.  So long as I know, I'm OK with it :-)
0
 
LVL 92

Expert Comment

by:objects
ID: 9674934
> 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
 
LVL 92

Expert Comment

by:objects
ID: 9674959
> 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
 
LVL 15

Expert Comment

by:jimmack
ID: 9674970
Thanx objects.  Same applies again:

>> So long as I know, I'm OK with it :-)
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video teaches viewers about errors in exception handling.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question