Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- class StartUp
- {
- static void Main()
- {
- string pizzaName = Console.ReadLine().Split()[1];
- // Read doughInfo
- string[] doughInfo = Console.ReadLine().Split();
- string flourType = doughInfo[1];
- string bakingTechnique = doughInfo[2];
- double weight = double.Parse(doughInfo[3]);
- List<Topping> toppings = new List<Topping>();
- while (true)
- {
- string[] toppingInfo = Console.ReadLine().Split();
- if (toppingInfo[0] == "END")
- {
- break;
- }
- string toppingType = toppingInfo[1];
- double toppingWeight = double.Parse(toppingInfo[2]);
- try
- {
- Topping topping = new Topping(toppingType, toppingWeight);
- toppings.Add(topping);
- }
- catch (ArgumentException ae)
- {
- Console.WriteLine(ae.Message);
- return;
- }
- }
- try
- {
- Dough dough = new Dough(flourType, bakingTechnique, weight);
- Pizza pizza = new Pizza(pizzaName, dough, toppings);
- Console.WriteLine($"{pizzaName} - {pizza.CalculateTotalCalories():f2} Calories.");
- }
- catch (ArgumentException ae)
- {
- Console.WriteLine(ae.Message);
- return;
- }
- }
- }
Add Comment
Please, Sign In to add comment