Advertisement
svetlyoek

Untitled

Jul 8th, 2019
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. namespace PizzaCalories
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. public class Engine
  8. {
  9. public void Run()
  10. {
  11. try
  12. {
  13. string[] pizzaItems = Console.ReadLine().Split();
  14. string pizzaName = pizzaItems[1];
  15.  
  16. string[] doughItems = Console.ReadLine().Split();
  17.  
  18. string flour = doughItems[1];
  19. string backeType = doughItems[2];
  20. double weight = double.Parse(doughItems[3]);
  21. Dough dough = new Dough(flour, backeType, weight);
  22.  
  23. Pizza pizza = new Pizza(pizzaName, dough);
  24.  
  25. string line = Console.ReadLine();
  26.  
  27. while (line != "END")
  28. {
  29. string[] toppingItems = line.Split();
  30.  
  31. string type = toppingItems[1];
  32. double weigh = double.Parse(toppingItems[2]);
  33. Topping topping = new Topping(type, weigh);
  34.  
  35. pizza.AddTopping(topping);
  36.  
  37. line = Console.ReadLine();
  38. }
  39.  
  40. Console.WriteLine(pizza.ToString());
  41. }
  42. catch (Exception ex)
  43. {
  44. Console.WriteLine(ex.Message);
  45. }
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement