// Import statements go here.  For example,
// import java.awt.Color;
import java.util.ArrayList;
// import java.util.Random;

/**
 *  Lab (or Programming Project) X: Name of Lab or PP<br>
 *
 *  One-sentence description of role or purpose of objects of this
 *  class goes here.
 *
 *  A more detailed description goes here, if necessary.
 *
 *  @author [your name]
 *  @author [your partner's name]
 *  @author [with assistance from ... (including instructor/TAs)]
 *  @author [working side-by-side with ...]
 *  @version [last_modification_date]
 */
public class Menu
{
    // State: instance variables and shared class variables go here.
    private String restName;
    private ArrayList<MenuItem> itemList;

    // Constructors

    /**
     * Constructs a new object of this class.
     * 
     *      @param   initialValue    initial value for the object's state
     */
    public Menu(String name)
    {
        // initialise instance variables
        this.restName = name;
        this.itemList = new ArrayList<MenuItem>();
    }

    // Methods

    /**
     * Gets the value of one of this object's attributes (replace this
     * description with a one-sentence summary of your own).
     * You may provide more details in later sentences, but note
     * that they will only appear in the Method Details section of
     * the class documentation, not the Method Summary section.
     * 
     *      @return the attribute value
     */
    public String getRestName()
    {
        return this.restName;
    }

    /**
     * Increments the object's state by the amount passed in as a parameter
     * (replace this description with a one-sentence summary of your own).
     * You may provide more details in later sentences, but note
     * that they will only appear in the Method Details section of
     * the class documentation, not the Method Summary section.
     * 
     *      @param  par a sample parameter for a method
     */
    public void addMenuItem(MenuItem newItem)
    {
        // Internal comments describe the purpose of blocks of code, e.g.
        // Add the value passed in as a parameter to the instance variable.
        this.itemList.add(newItem);
    }

    /**
     * Prints menu.
     */
    public void printMenu()
    {
        for ( MenuItem oneItem : this.itemList )
        {
            System.out.println("\t" + oneItem.toString());  // tab + item info
        }
    }
    
    /**
     * Gets price of a single menu item.
     */
    public double getPriceOf(String itemName)
    {
        for ( MenuItem oneItem : this.itemList )
        {
            if ( oneItem.getItemName().equals(itemName) )
                return oneItem.getPrice();
        }
        
        return -1.0;
    }
}
