static void Main(string[] args) { Sandwich s1 = new Sandwich(); s1.toastSandwich(); Sandwich s2 = new Sandwich( "white", new List <string>() { "turkey", "bacon" }, new List <string>() { "lettuce", "tomato", "avacado" }, new List <string>() { "mayo" }, 8.12, 500, true ); Console.WriteLine(s1.getDescription()); Console.WriteLine(s2.getDescription()); Panini p1 = new Panini( "baguette", new List <string>() { "ham", "roasted pork" }, new List <string>() { "swiss cheese" }, new List <string>() { "mustard" }, 7.75, 550 ); Console.WriteLine(p1.getDescription()); }
private void food_Click(object sender, EventArgs e) { Button buttonClicked = sender as Button; int rowIndex = orderDetails.Rows.Add(); var row = orderDetails.Rows[rowIndex]; IFood food; switch (buttonClicked.Name) { case "French Baguette": food = new FrenchBaguette(); row.Cells["item"].Value = buttonClicked.Name; row.Cells["price"].Value = food.price; stock.frenchBaguetteStock -= 1; break; case "Soft Bread": food = new SoftBread(); row.Cells["item"].Value = buttonClicked.Name; row.Cells["price"].Value = food.price; stock.softBreadStock -= 1; break; case "Apple Smoothy": food = new AppleSmoothy(); row.Cells["item"].Value = buttonClicked.Name; row.Cells["price"].Value = food.price; stock.appleSmoothyStock -= 1; break; case "Coke": food = new Coke(); row.Cells["item"].Value = buttonClicked.Name; row.Cells["price"].Value = food.price; stock.cokeStock -= 1; break; case "Ham Sandwich": food = new HamSandwich(); row.Cells["item"].Value = buttonClicked.Name; row.Cells["price"].Value = food.price; stock.hamSandwichStock -= 1; break; case "Panini": food = new Panini(); row.Cells["item"].Value = buttonClicked.Name; row.Cells["price"].Value = food.price; stock.paniniStock -= 1; break; case "Cookie": food = new Cookie(); row.Cells["item"].Value = buttonClicked.Name; row.Cells["price"].Value = food.price; stock.cookieStock -= 1; break; case "Cheese Cake": food = new CheeseCake(); row.Cells["item"].Value = buttonClicked.Name; row.Cells["price"].Value = food.price; stock.cheeseCakeStock -= 1; buttonClicked.Text = "Cheese Cake " + stock.cheeseCakeStock; break; } updateTotal(); loadButtonsText(); }