This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line!
See this thread for details.
Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Cannot make java find the symbol

 
Ranch Hand
Posts: 52
1
MySQL Database Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get a "Cannot Find Symbol" error on this script


But the compiler says I can't find the symbol Dough, Sauce ect
So I say Ok I don't know what objects I want these to point to yet so I will define them as null objects

The compiler says thanks for those declarations they are all legal
by the way I can't find the symbol Dough, Sauce ect
So I say Ok I will make Dough point to an actual object if that will make you happy

And the compiler says your new declaration is quite legal
by the way I can't find the symbol Dough, Sauce ect
And I say stuff you compiler im going to watch some funny stuff on youtube
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say:

That says it's going to have a return type of Dough. So there needs to be a class (or interface) called Dough. You've tried to fix it by creating a variable called Dough, but that's something else entirely.

If Dough, Sauce etc are just supposed to be instances of the class Ingredient, then your CreateXxx() methods need to be declared to have Ingredient as a return type (which again needs to be declared somewhere).
 
Stephen Black
Ranch Hand
Posts: 52
1
MySQL Database Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So If I am using a factory pattern or any programming method where a returned object type is not known
I must use the super type as the return type
Get it
It works
Yay
Thanks
 
Marshal
Posts: 68052
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there is something wrong with your design of pizza classes, but haven’t got the time to go through it in detail now. Please post the complete code.
 
Stephen Black
Ranch Hand
Posts: 52
1
MySQL Database Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you mention before something about pizza type being cheese
Some people like cheese pizzas apparently its pizza with sauce and cheese
Not my idea of a good pizza though but my pretend java pizza shop sells them

Campbell Ritchie wrote:I think there is something wrong with your design of pizza classes, but haven’t got the time to go through it in detail now. Please post the complete code.


 
Bartender
Posts: 10777
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephen Black wrote:Not my idea of a good pizza though but my pretend java pizza shop sells them


Why pretend? Why not try to model the thing accurately, but start out with a limited number of options?

What happens when you go into a pizza joint?

Chances are that you will have "Pizza" on the menu, and then a whole bunch of optional toppings and sauces that you can add to a plain pizza to make the final product.

One thing I'd suggest is to look at enums - extremely useful for this sort of problem. They can also implement interfaces (Topping?/Ingredient?), and so can make good factories.

Winston
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!