Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _04._New_House
- {
- class Program
- {
- static void Main(string[] args)
- {
- string flowerType = Console.ReadLine();
- int flowerNumber = int.Parse(Console.ReadLine());
- int budget = int.Parse(Console.ReadLine());
- double singleFlowerPrice = 0;
- switch (flowerType)
- {
- case "Roses":
- singleFlowerPrice = 5;
- break;
- case "Dahlias":
- singleFlowerPrice = 3.80;
- break;
- case "Tulips":
- singleFlowerPrice = 2.80;
- break;
- case "Narcissus":
- singleFlowerPrice = 3;
- break;
- case "Gladiolus":
- singleFlowerPrice = 2.50;
- break;
- }
- double totalPrice = flowerNumber * singleFlowerPrice;
- if (flowerNumber > 80 && flowerType == "Rose")
- {
- totalPrice = totalPrice - totalPrice * 0.1;
- }
- else if (flowerNumber > 90 && flowerType == "Dahlias")
- {
- totalPrice = totalPrice - totalPrice * 0.15;
- }
- else if (flowerNumber > 80 && flowerType == "Tulips")
- {
- totalPrice = totalPrice - totalPrice * 0.1;
- }
- else if (flowerNumber < 120 && flowerType == "Narcissus")
- {
- totalPrice = totalPrice + 0.15 * totalPrice;
- }
- else if (flowerNumber < 80 && flowerType == "Gladiolus")
- {
- totalPrice = totalPrice + 0.2 * totalPrice;
- }
- if (budget >= totalPrice)
- {
- Console.WriteLine($"Hey, you have a great garden with {flowerNumber} {flowerType} and {(budget - totalPrice):F2} leva left.");
- }
- else
- Console.WriteLine($"Not enough money, you need {(totalPrice - budget):F2} leva more.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement