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 flowers = Console.ReadLine();
- int flowersCount = int.Parse(Console.ReadLine());
- int budget = int.Parse(Console.ReadLine());
- Double price = 0;
- Double discount = 0;
- if (flowers == "Roses")
- {
- price = flowersCount * 5;
- if (flowersCount > 80)
- {
- discount = 0.1;
- price = price - (price * discount);
- }
- }
- else if (flowers == "Dahlias")
- {
- price = flowersCount * 3.8;
- if (flowersCount > 90)
- {
- discount = 0.15;
- price = price - (price * discount);
- }
- }
- else if (flowers == "Tulips")
- {
- price = flowersCount * 2.8;
- if (flowersCount > 80)
- {
- discount = 0.15;
- price = price - (price * discount);
- }
- }
- else if (flowers == "Narcissus")
- {
- price = flowersCount * 3.0;
- if (flowersCount < 120)
- {
- discount = 1.15;
- price = price * discount;
- }
- }
- else if (flowers == "Gladiolus")
- {
- price = flowersCount * 2.5;
- if (flowersCount < 80)
- {
- discount = 1.20;
- price = price * discount;
- }
- }
- if ((budget - price) > 0)
- {
- Console.WriteLine($"Hey, you have a great garden with {flowersCount} {flowers} and {budget - price:f2} leva left.");
- }
- else if ((budget - price) < 0)
- {
- Console.WriteLine($"Not enough money, you need {(budget - price) * -1:F2} leva more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement