Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-20-2007, 02:42 AM
Member
 
Join Date: Dec 2007
Posts: 1
turbo4xl is on a distinguished road
Please help
What is the problem here

import java.io.*;

/**
* Pizza.java
* Stores the information for one pizza.
*/
class Pizza
{
public static final String[] SIZES = {"small", "medium", "large"};
// Different pizza sizes.
private Toppings toppings;
private String size;

/**
* Constructor of "old" pizzas (from the load file).
* @param s Pizza size.
* @param t List of toppings.
*/
public Pizza(String s, String t)
{
size = s;
toppings = new Toppings(t);
}

/**
* Constructor of new pizzas.
*/
public Pizza()
{
}

/**
* Get this pizza's size.
* @return The size of a pizza.
*/
public String getSize()
{
return size;
}

/**
* Input the pizza size.
*/
public void setSize() throws IOException
{
size = SIZES[InputOutputOperations.pickOption("Input a choice", SIZES)];
}

/**
* Input the toppings for this pizza.
*/
public void setToppings() throws IOException
{
toppings = new Toppings();
toppings.setToppings(InputOutputOperations.pickCho ices("Input choices", Toppings.TOPPINGS_LIST));
}

/**
* Get the toppings for this pizza.
* @return The toppings for this pizza.
*/
public Toppings getToppings()
{
return toppings;
}

/**
* Get a string representation of this pizza.
* @return Representation of pizza.
*/
public String toString()
{
return size + toppings;
}

/**
* Get the price of this pizza.
* @return Price of pizza.
*/
public double getPrice()
{
double total = 0;
if(size.equals("small"))
total = 11.99;
else if(size.equals("medium"))
total = 14.99;
else
total = 16.99;

int count = toppings.getNumberOfToppings();

if(count > 3)
total = total + (count - 3) * 1.00;

return total;
}
}



Error
Toppings toppings; cannot find symbol
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-20-2007, 09:07 AM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Maybe this will help?

-Capt
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +3. The time now is 11:44 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org