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

/**
 *  Experimenting with Menu and MenuItem Classes<br>
 *
 *  The <code>MainForMenuDemo</code> class provides a main method
 *  for a program that uses a Menu class.
 *
 *  UNDER CONSTRUCTION:  A more detailed description goes here, if necessary.
 *
 *  @author Alyce Brady (getting started)
 *  @author [your name]
 *  @author [with assistance from ... (including instructor/TAs)]
 *  @author [working side-by-side with ...]
 *  @version [last_modification_date]
 */
public class MainForMenuDemo
{
    /**
     *  The main function initiates execution of this program.
     *    @param    String[] args not used in this program
     *              (but main methods always need this parameter)
     **/
    public static void main(String[] args)
    {
        System.out.println ("Welcome to the Menu / MenuItem Experiment.");

        // Read menu items from the file.
        String filename = "MenuItems.txt";
        MenuItemReader reader = new MenuItemReader(filename);
        
        /* This is what we want to have... */
        Menu carrabas = new Menu("Carrabba's");
        Menu chinnchinn = new Menu("Chinn Chinn");
        Menu hunangardens = new Menu("Hunan Gardens");
        Menu saffron = new Menu("Saffron");


        /* Code from Loop Demo main that we want to replace. */
        String nextLine;
        for ( nextLine = reader.getNextLine(); nextLine != null;
              nextLine = reader.getNextLine() )
        {
            // Each line has the restaurant, menu item, and price for a menu item.
            MenuItem newItem = reader.convertToMenuItem(nextLine);
            /* What we want to do: */
               if ( newItem.getRestaurant().contains("Carr") )
                    carrabas.addMenuItem(newItem);
               else if ( newItem.getRestaurant().contains("Chinn") )
                    chinnchinn.addMenuItem(newItem);
               else if ( newItem.getRestaurant().contains("Hunan") )
                    hunangardens.addMenuItem(newItem);
               else if ( newItem.getRestaurant().contains("Saffron") )
                    saffron.addMenuItem(newItem);
        }
        

        /* Print the menu for one of the restaurants. */
        System.out.println("Menu for " + carrabas.getRestName() + ":");
        carrabas.printMenu();


        /* Get the price of Coca-Cola at each restaurant. */
        System.out.println("The price of Coca-Cola at " +
              saffron.getRestName() + " is " + saffron.getPriceOf("Coca-Cola"));

        /* Get the average price for each restaurant. */
        // System.out.println("The average price at " +
        //      chinnchinn.getRestName() + " is " + chinnchinn.getAvgPrice());

        /* How many items does each restaurant have under $10?
         *    (NOTE: A method that returns a list of all items under a certain amount
         *    would be useful in more circumstances than a method that returns
         *    the count.)
         */
        // System.out.println(hunangardens.getRestName() + " has " + 
        //      hunangardens.allItemUnder(10.0).size() + " inexpensive items.");

        /* What is the most expensive item at each restaurant? */
        // System.out.println("The most expensive item at " +
        //      chinnchinn.getRestName() + " is " + chinnchinn.getMostExpensive());


    }
}
