Advertisement
dsavov_02

bira i vino

Mar 23rd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. int wines = 300;
  8. int wineO = 0;
  9. int wineD = 0;
  10. int beers = 200;
  11. int beerO = 0;
  12. int beerD = 0;
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19. while (true)
  20. {
  21. string input = Console.ReadLine();
  22. if (input == "END")
  23. {
  24. break;
  25. }
  26. string[] str = input.Split(':');
  27. string drink = str[0];
  28. int quantity = int.Parse(str[1]);
  29. if (drink == "Beers")
  30. {
  31. if (quantity > beers)
  32. {
  33. Console.WriteLine("We don't have enought beers for you");
  34. continue;
  35. }
  36. beers += quantity;
  37. if (quantity > 0)
  38. {
  39. beerD++;
  40. }
  41. if (quantity < 0 || quantity > 0)
  42. {
  43. beerO++;
  44. }
  45.  
  46.  
  47.  
  48.  
  49. }
  50. if (drink == "Wines")
  51. {
  52. if (quantity > wines)
  53. {
  54. Console.WriteLine("We don't have enought wines for you");
  55. continue;
  56. }
  57. wines += quantity;
  58. if (quantity > 0)
  59. {
  60. wineD++;
  61. }
  62. if (quantity < 0 || quantity > 0)
  63. {
  64. wineO++;
  65. }
  66. }
  67.  
  68. }
  69.  
  70. Console.WriteLine("Wines: " + wines);
  71. Console.WriteLine("Deliveries: " + wineD);
  72. Console.WriteLine("Orders: " + wineO);
  73.  
  74. Console.WriteLine("Bears: " + beers);
  75. Console.WriteLine("Deliveries: " + beerD);
  76. Console.WriteLine("Orders: " + beerO);
  77.  
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement