Advertisement
alexbancheva

New House

Nov 14th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. using System;
  2.  
  3. namespace New_Home
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string typeFlower = Console.ReadLine();
  10. double countOfFlowers = double.Parse(Console.ReadLine());
  11. double budget = double.Parse(Console.ReadLine());
  12.  
  13.  
  14. double totalCost = 0;
  15. double discount = 0;
  16. double expensive = 0;
  17.  
  18. if (typeFlower == "Roses")
  19. {
  20.  
  21. totalCost = countOfFlowers * 5;
  22.  
  23. if (countOfFlowers > 80)
  24. {
  25. discount = totalCost * 0.1;
  26. totalCost = totalCost - discount;
  27. }
  28. }
  29. else if (typeFlower == "Dahlias")
  30. {
  31. totalCost = countOfFlowers * 3.8;
  32.  
  33. if (countOfFlowers > 90)
  34. {
  35. discount = totalCost * 0.15;
  36. totalCost = totalCost - discount;
  37. }
  38. }
  39. else if (typeFlower == "Tulips")
  40. {
  41. totalCost = countOfFlowers * 2.8;
  42.  
  43. if (countOfFlowers > 80)
  44. {
  45. discount = totalCost * 0.15;
  46. totalCost = totalCost - discount;
  47. }
  48. }
  49. else if (typeFlower == "Narcissus")
  50. {
  51. totalCost = countOfFlowers * 3;
  52.  
  53. if (countOfFlowers < 120)
  54. {
  55. expensive = totalCost * 0.15;
  56. totalCost = totalCost + expensive;
  57. }
  58. }
  59. else if (typeFlower == "Gladiolus")
  60. {
  61. totalCost = countOfFlowers * 2.5;
  62.  
  63. if (countOfFlowers < 80)
  64. {
  65. expensive = totalCost * 0.2;
  66. totalCost = totalCost + expensive;
  67. }
  68. }
  69.  
  70. if (budget >= totalCost)
  71. {
  72. Console.WriteLine($"Hey, you have a great garden with {countOfFlowers} {typeFlower} and {budget-totalCost:f2} leva left.");
  73. }
  74. else if (budget < totalCost)
  75. {
  76. Console.WriteLine($"Not enough money, you need {totalCost-budget:f2} leva more.");
  77. }
  78.  
  79. }
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement