Ejemplo n.º 1
0
 public void FillMyMachine(string sFilePath)
 {
     //List<string> sList = new List<string>();
     using (StreamReader newSR = new StreamReader(sFilePath))
     {
         while (!newSR.EndOfStream)
         {
             string    sLine         = newSR.ReadLine();
             string[]  saStringArray = sLine.Split('|');
             SnackItem siSnack       = new SnackItem(saStringArray);
             AddItemToMachine(siSnack);
         }
     }
 }
Ejemplo n.º 2
0
        public string DispenseItem(SnackItem Snack)
        {
            string result = "";

            switch (Snack.sType)
            {
            case "Chip": result = "Crunch Crunch, Yum!\n" + ".~~~~~. \n" +
                                  "|-----|\n" +
                                  "|CHIPS|\n" +
                                  "|-----|\n" +
                                  "|_____|\n";

                break;

            case "Candy": result = "Munch Munch, Yum!\n" + "       \n" +
                                   " .---. \n" +
                                   "(CANDY)\n" +
                                   " '---' \n" +
                                   "       ";
                break;

            case "Drink": result = "Glug Glug, Yum!\n" + " ____ \n" +
                                   "[____] \n" +
                                   "|SODA| \n" +
                                   "|____| \n" +
                                   "[____] ";
                break;

            case "Gum": result = "Chew Chew, Yum!\n" + "       \n" +
                                 " .---. \n" +
                                 "| GUM |\n" +
                                 "'-----'\n" +
                                 "      ";
                break;
            }
            return(result);
        }
Ejemplo n.º 3
0
 public void DecrementAmountOfSnack(SnackItem Snack, int nAmount)
 {
     Snack.nAmount -= nAmount;
 }
Ejemplo n.º 4
0
 public void IncrementAmountOfSnack(SnackItem Snack, int nAmount)
 {
     Snack.nAmount += nAmount;
 }
Ejemplo n.º 5
0
 public void AddItemToMachine(SnackItem Snack)
 {
     VendItems.Add(Snack.sLocation, Snack);
 }