Results 1 to 2 of 2

Thread: Please help

  1. #1
    turbo4xl is offline Member
    Join Date
    Dec 2007
    Posts
    1
    Rep Power
    0

    Default 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

  2. #2
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    Location
    NewEngland, US
    Posts
    835
    Rep Power
    9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •