This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Error: Cannot Find Symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Error: Cannot Find Symbol" Watch "Error: Cannot Find Symbol" New topic
Author

Error: Cannot Find Symbol

Rykurex Peters
Greenhorn

Joined: Oct 28, 2012
Posts: 21
This program is intended to calculate the amount of paint needed, and cost, to paint a room (4 walls + ceiling)

Edit: My original problem has been solved, now I just have a question about these two codes, which (I hope) do the same thing.
Also, I know I have a method call to ceiling, which currently doesn't exist, the point of this method is to give me an integer value to store as number of tins (because you can't buy half a tin of paint...) is there a simple way for me to do this ?
Thanks again everybody <3

This first code has a separate method for each calculation / assignment to a variable. I want to know if this is actually needed? Or, because these calculations are simple, is it both easier and more functional to do all of these calculations under one method?




Second code;


fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11161
    
  16

you have a method named areaToPaint(), but you don't have a variable named that. so the line

is wrong - you are trying to save a value in a variable that doesn't exist.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Rameshwar Soni
Ranch Hand

Joined: Feb 03, 2011
Posts: 247
In your code you are using variables but you haven't declared them before using, so along with your length, width, height variables declare them too. i.e.


Once you do that you will have one error pointing to the ceiling method i.e.


Here ceiling is method since it has () i.e. parenthesis after its name. So check it out.

And Welcome to Ranch!!!
Rykurex Peters
Greenhorn

Joined: Oct 28, 2012
Posts: 21
Thanks a lot guys, I'll click resolved in a few hours, I just want to see if anybody replies about the question
I'm really impressed with how fast people got back too, it's been a big help
Rameshwar Soni
Ranch Hand

Joined: Feb 03, 2011
Posts: 247
@Rykurex Peters----------- One advice that i would like to give is that after you receive any answers you should not edit or do changes in your Original question because then the answers given seems to be meaningless, instead you should post a new reply to the same thread with your updated code.

Say for example Fred and me both told you that you haven't declared variables in your original code and then after receiving the answers you went and did those changes in your original question and now Fred's and mine answer looks meaningless to others who view this thread.

Rameshwar Soni
Ranch Hand

Joined: Feb 03, 2011
Posts: 247
Rykurex Peters wrote:
Edit: My original problem has been solved, now I just have a question about these two codes, which (I hope) do the same thing.

This first code has a separate method for each calculation / assignment to a variable. I want to know if this is actually needed? Or, because these calculations are simple, is it both easier and more functional to do all of these calculations under one method?



So basically now you want to know which code is better, more functional, has good performance etc. out of the 2 codes.

I think you should not worry about all these things (i.e. performance) at this stage.

So
  • do what you feel is simple, comfortable and gives you correct answer
  • Focus on learning and understanding concepts in Java


  • Once you are done with this then there are many books to help you write BETTER code like Effective Java but before this at least finish concepts in Java.

    Thanks......
     
    Don't get me started about those stupid light bulbs.
     
    subject: Error: Cannot Find Symbol
     
    Similar Threads
    class invalid for deserialization
    Beginner Question: Class Capabilities
    inheritance problem
    compile error
    who can answer this question ?