Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace NewHouse
- {
- class Program
- {
- static void Main(string[] args)
- {
- string flower = Console.ReadLine();
- int quantity = int.Parse(Console.ReadLine());
- int budget = int.Parse(Console.ReadLine());
- double price = 0;
- double moneyLeft = 0;
- double moneyNeed = 0;
- switch (flower)
- {
- case "Roses":
- if (quantity > 80)
- {
- price = (quantity * 5) * 0.9;
- }
- else
- {
- price = (quantity * 5);
- }
- break;;
- case "Dahlias":
- if (quantity > 90)
- {
- price = (quantity * 3.8) * 0.85;
- }
- else
- {
- price = (quantity * 3.8);
- }
- break;
- case "Tulips":
- if (quantity > 80)
- {
- price = (quantity * 2.8) * 0.85;
- }
- else
- {
- price = (quantity * 2.8);
- }
- break;
- case "Narcissus":
- if (quantity < 120)
- {
- price = (quantity * 3) * 1.15;
- }
- else
- {
- price = (quantity * 3);
- }
- break;
- case "Gladiolus":
- if (quantity < 80)
- {
- price = (quantity * 2.5) * 1.2;
- }
- else
- {
- price = (quantity * 2.5);
- }
- break;
- }
- if (budget >= price)
- {
- moneyLeft = budget - price;
- Console.WriteLine($"Hey, you have a great garden with {quantity} {flower} and {moneyLeft:F2} leva left.");
- }
- else
- {
- moneyNeed = price - budget;
- Console.WriteLine($"Not enough money, you need {moneyNeed:F2} leva more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement