public static void Main() { Pizza pizza = new Pizza(); try { var name = Console.ReadLine().Substring(6); pizza.Name = name; } catch (Exception ex) { Console.WriteLine(ex.Message); return; } try { input = Console.ReadLine().Split(); type = input[1].ToLower(); var technique = input[2].ToLower(); quantity = Convert.ToDouble(input[3]); var dough = new Dough(type, technique, quantity); pizza.Dough = dough; } catch (Exception ex) { Console.WriteLine(ex.Message); return; } input = Console.ReadLine().ToLower().Split(); while (input[0] != "end") { try { type = input[1]; quantity = Convert.ToDouble(input[2]); var topping = new Topping(type, quantity); pizza.Add(topping); } catch (Exception ex) { Console.WriteLine(ex.Message); return; } input = Console.ReadLine().ToLower().Split(); } Console.WriteLine($"{pizza.Name} - {pizza.TotalCalories():F2} Calories."); }
static void Main(string[] args) { // Pizza Meatless //Dough Wholegrain Crispy 100 //Topping Veggies 50 //Topping Cheese 50 //END Pizza pizza; Dough dough; try { string[] pizzaInfo = Console.ReadLine().Split(); string pizzaName = pizzaInfo[1]; pizza = new Pizza(pizzaName); string[] doughInfo = Console.ReadLine().Split(); string flour = doughInfo[1]; string bakingTech = doughInfo[2]; double weight = double.Parse(doughInfo[3]); dough = new Dough(flour.ToLower(), bakingTech.ToLower(), weight); pizza.PizzaDough = dough; string toppingInfo; while ((toppingInfo = Console.ReadLine()) != "END") { string[] toppingParams = toppingInfo.Split(); string toppingName = toppingParams[1].ToLower(); double toppingWeight = double.Parse(toppingParams[2]); Topping topping = new Topping(toppingName, toppingWeight); pizza.Add(topping); } Console.WriteLine($"{pizza.Name} - {pizza.PizzaCalories():f2} Calories."); } catch (Exception e) { Console.WriteLine(e.Message); return; } }
public void Run() { var pizzaInfo = Console.ReadLine().Split(); Pizza pizza = new Pizza(pizzaInfo[1]); var doughInfo = Console.ReadLine().Split(); Dough dough = new Dough(doughInfo[1], doughInfo[2], double.Parse(doughInfo[3])); pizza.Dough = dough; string toppings; while ((toppings = Console.ReadLine()) != "END") { var toppingsInfo = toppings.Split(); Topping topping = new Topping(toppingsInfo[1], double.Parse(toppingsInfo[2])); pizza.Add(topping); } Console.WriteLine($"{pizza.Name} - {pizza.TotalCalories:f2} Calories."); }
public void AddMushrooms(Pizza pizza) { pizza.Add("Mushroom"); }
public void AddSausage(Pizza pizza) { pizza.Add("Sausage"); }
public void AddPepperoni(Pizza pizza) { pizza.Add("Pepperoni"); }
public void AddChicken(Pizza pizza) { pizza.Add("Chicken"); }
public void SpreadSauce(Pizza pizza) { pizza.Add("Classic Sauce"); }
public void AddOlives(Pizza pizza) { pizza.Add("Spanish Arbequina"); }
public void AddCheese(Pizza pizza) { pizza.Add("Basic Cheese"); }
public void SpreadSauce(Pizza pizza) { pizza.Add("Artisan sauce"); }
public void RollDough(Pizza pizza) { pizza.Add("Artisan dough"); }
public void AddCheese(Pizza pizza) { pizza.Add("Artisan cheese"); }
public void AddPeppers(Pizza pizza) { pizza.Add("Padon Pepper"); }
public void AddOlives(Pizza pizza) { pizza.Add("Black olives"); }
public void RollDough(Pizza pizza) { pizza.Add("Classic Dough"); }
public void AddPeppers(Pizza pizza) { pizza.Add("Green peppers"); }
public void AddMushrooms(Pizza pizza) { pizza.Add("Fungus d'jour"); }