Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Softuni
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string flower = Console.ReadLine();
- int flowersCount = int.Parse(Console.ReadLine());
- double budget = double.Parse(Console.ReadLine());
- double flowerPrice = 0.0;
- switch (flower)
- {
- case "Roses":
- flowerPrice = 5;
- if(flowersCount > 80)
- {
- flowerPrice = flowerPrice - (flowerPrice * 0.1);
- }
- break;
- case "Dahlias":
- flowerPrice = 3.8;
- if (flowersCount > 90)
- {
- flowerPrice = flowerPrice - (flowerPrice * 0.15);
- }
- break;
- case "Tulips":
- flowerPrice = 2.8;
- if (flowersCount > 80)
- {
- flowerPrice = flowerPrice - (flowerPrice * 0.15);
- }
- break;
- case "Narcissus":
- flowerPrice = 3;
- if (flowersCount < 120)
- {
- flowerPrice = flowerPrice + (flowerPrice * 0.15);
- }
- break;
- case "Gladiolus":
- flowerPrice = 2.5;
- if (flowersCount < 80)
- {
- flowerPrice = flowerPrice + (flowerPrice * 0.2);
- }
- break;
- }
- double sum = flowerPrice * flowersCount;
- if (sum <= budget)
- {
- double moneyLeft = budget - sum;
- Console.WriteLine($"Hey, you have a great garden with {flowersCount} {flower} and {moneyLeft:f2} leva left.");
- }
- else if(sum > budget)
- {
- double moneyNeeded = sum - budget;
- Console.WriteLine($"Not enough money, you need {moneyNeeded:f2} leva more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement