Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04._New_House
  4. {
  5. class Program
  6. {
  7. private const int rose = 5;
  8. private const double dahh = 3.80;
  9. private const double tulips = 2.80;
  10. private const int narcissus = 3;
  11. private const double gladiolus = 2.50;
  12. static void Main(string[] args)
  13. {
  14.  
  15. string flower = Console.ReadLine();
  16. int flowerCount = int.Parse(Console.ReadLine());
  17. int budget = int.Parse(Console.ReadLine());
  18.  
  19. double flowersOfGladiolus = flowerCount * gladiolus;
  20. double flowersOfNarcissus = flowerCount * narcissus;
  21. double flowersOfTulips = flowerCount * tulips;
  22. double flowersOfDah = flowerCount * dahh;
  23. double flowersOfRose = flowerCount * rose;
  24.  
  25.  
  26.  
  27.  
  28. double allSum = 0;
  29. double sumLeft = 0;
  30. double all = 0.0;
  31.  
  32. if (flower == "Roses")
  33. {
  34. if (flowerCount > 80)
  35. {
  36. allSum = flowerCount * rose * 0.9;
  37. all = Math.Abs(allSum);
  38. sumLeft = budget - allSum;
  39. }
  40. else if (flowerCount <= 80)
  41. {
  42. allSum = flowerCount * rose;
  43. all = Math.Abs(allSum);
  44. sumLeft = budget - allSum;
  45. }
  46. }
  47. else if (flower == "Dahlias")
  48. {
  49. if (flowerCount > 90)
  50. {
  51. allSum = flowerCount * dahh * 0.85;
  52. all = Math.Abs(allSum);
  53. sumLeft = budget - allSum;
  54. }
  55. else if (flowerCount <= 90)
  56. {
  57. allSum = flowerCount * dahh;
  58. all = Math.Abs(allSum);
  59. sumLeft = budget - allSum;
  60. }
  61. }
  62. else if (flower == "Tulips")
  63. {
  64. if (flowerCount > 80)
  65. {
  66. allSum = flowerCount * tulips * 0.85;
  67. sumLeft = budget - allSum;
  68. }
  69. else if (flowerCount <= 80)
  70. {
  71. allSum = flowerCount * tulips;
  72. sumLeft = budget - allSum;
  73. }
  74. }
  75. else if (flower == "Narcissus")
  76. {
  77. if (flowerCount < 120)
  78. {
  79. allSum = (flowerCount * narcissus) * 0.15;
  80. all = allSum + (flowerCount * narcissus);
  81. sumLeft = budget - all;
  82. }
  83. else if (flowerCount >= 120)
  84. {
  85. allSum = flowerCount * narcissus;
  86. sumLeft = budget - allSum;
  87. }
  88. }
  89. else if (flower == "Gladiolus")
  90. {
  91. if (flowerCount < 80)
  92. {
  93. allSum = (flowerCount * gladiolus) * 0.20;
  94. all = flowersOfGladiolus + allSum;
  95. sumLeft = budget - all;
  96. }
  97. else if (flowerCount >= 80)
  98. {
  99. allSum = flowerCount * gladiolus;
  100. all = Math.Abs(allSum);
  101. sumLeft = budget - allSum;
  102. }
  103.  
  104.  
  105. }
  106. if (budget >= all)
  107. {
  108. Console.WriteLine($"Hey, you have a great garden with {flowerCount} {flower} and {Math.Abs(sumLeft):f2} leva left.");
  109.  
  110. }
  111. else
  112. {
  113. Console.WriteLine($"Not enough money, you need {Math.Abs(sumLeft):F2} leva more.");
  114. }
  115. }
  116. }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement