aspose file tools*
The moose likes Beginning Java and the fly likes Elevator Errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Elevator Errors" Watch "Elevator Errors" New topic
Author

Elevator Errors

Alex Munoz
Greenhorn

Joined: Oct 26, 2012
Posts: 10




I get errors saying it cannot find symbol elevator1 and I am unsure of how to reformat it so that it works. Please point out all other errors that you see! I'm really grinding through this.
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5


What is elevator1 in your Elevator class? It's not declared anywhere (nor it should be) and you are trying to use it as an object. That's why you are getting that error (which says the same thing I just wrote). You are trying to do the same thing at lines 60 and 64 of the code you posted. Also, at lines 60 and 64 you are using getDirection() method as a field and those if(s) can be avoided with switch making your code look better.

In addition setTargetFloor(...) method is just wrong and not doing what you (probably) wanted it to do.


The quieter you are, the more you are able to hear.
Alex Munoz
Greenhorn

Joined: Oct 26, 2012
Posts: 10
What would I change elevator 1 to? I can't think of any alternative.

Would I change setDirection to getDirection to fix that?
Paul Witten
Ranch Hand

Joined: Oct 10, 2012
Posts: 86
Alex Munoz wrote:What would I change elevator 1 to? I can't think of any alternative.

Would I change setDirection to getDirection to fix that?


I think he means here Alex:



I think he means to just get rid of "elevator1.setDirection()" and replace with "setDirection()". That is normal and customary when calling a method from within the class. You're not calling setDirection() from outside the class. You're calling from within, so the class knows how to find setDirection(). It's a member of "this", meaning the current instance of the class.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Elevator Errors