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