Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.Design;
- using System.Globalization;
- using System.Reflection;
- using System.Runtime.ConstrainedExecution;
- using System.Security.Cryptography;
- namespace SomeExcercises
- {
- class Program
- {
- static void Main(string[] args)
- {
- double finalPrice = 0;
- string flowerType = Console.ReadLine();
- int numberOfFlowers = int.Parse(Console.ReadLine());
- double budget = double.Parse(Console.ReadLine());
- switch (flowerType)
- {
- case "Roses":
- if (numberOfFlowers > 80)
- {
- finalPrice = numberOfFlowers * 5;
- finalPrice -= finalPrice * 0.10;
- }
- else
- {
- finalPrice = numberOfFlowers * 5;
- }
- break;
- case "Dahlias":
- if (numberOfFlowers > 90)
- {
- finalPrice = numberOfFlowers * 3.80;
- finalPrice -= finalPrice * 0.15;
- }
- else
- {
- finalPrice = numberOfFlowers * 3.80;
- }
- break;
- case "Tulips":
- if (numberOfFlowers > 80)
- {
- finalPrice = numberOfFlowers * 2.80;
- finalPrice -= finalPrice * 0.15;
- }
- else
- {
- finalPrice = numberOfFlowers * 2.80;
- }
- break;
- case "Narcissus":
- if (numberOfFlowers < 120)
- {
- finalPrice = numberOfFlowers * 3;
- finalPrice += finalPrice * 0.15;
- }
- else
- {
- finalPrice = numberOfFlowers * 3;
- }
- break;
- case "Gladiolus":
- if (numberOfFlowers < 80)
- {
- finalPrice = numberOfFlowers * 2.50;
- finalPrice += finalPrice * 0.20;
- }
- else
- {
- finalPrice = numberOfFlowers * 2.50;
- }
- break;
- default:
- break;
- }
- if (budget > finalPrice)
- {
- Console.WriteLine($"Hey, you have a great garden with {numberOfFlowers} {flowerType} and {(budget - finalPrice):f2} leva left.");
- }
- else if (budget < finalPrice)
- {
- Console.WriteLine($"Not enough money, you need {(finalPrice - budget):f2} leva more.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment