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); } } }
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); }
public void DecrementAmountOfSnack(SnackItem Snack, int nAmount) { Snack.nAmount -= nAmount; }
public void IncrementAmountOfSnack(SnackItem Snack, int nAmount) { Snack.nAmount += nAmount; }
public void AddItemToMachine(SnackItem Snack) { VendItems.Add(Snack.sLocation, Snack); }