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