Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace homeworkconditional
- {
- class Program
- {
- static void Main(string[] args)
- {
- string flowerType = Console.ReadLine();
- var flowerCount = int.Parse(Console.ReadLine());
- var budget = int.Parse(Console.ReadLine());
- double rosePrice = 5.0;
- double dahliasPrice = 3.8;
- double tulipPrice = 2.8;
- double narcissusPrice = 3.0;
- double gladiolusPrice = 2.5;
- var bill = 0.0;
- if (flowerType == "Roses" )
- {
- bill = (flowerCount * rosePrice);
- if (flowerCount > 80)
- {
- bill = (flowerCount * rosePrice) * 0.90;
- }
- }
- else if (flowerType == "Dahlias" )
- {
- bill = (flowerCount * dahliasPrice);
- if (flowerCount > 90)
- {
- bill = (flowerCount * dahliasPrice) * 0.85;
- }
- }
- else if (flowerType == "Tulips")
- {
- bill = (flowerCount * tulipPrice);
- if (flowerCount > 80)
- {
- bill = (flowerCount * tulipPrice) * 0.85;
- }
- }
- else if (flowerType == "Narcissus" )
- {
- bill = (flowerCount * narcissusPrice);
- if (flowerCount < 120)
- {
- bill = (flowerCount * narcissusPrice) * 1.15;
- }
- }
- else if (flowerType == "Gladiolus" )
- {
- bill = (flowerCount * gladiolusPrice);
- if (flowerCount < 80)
- {
- bill = (flowerCount * gladiolusPrice) * 1.20;
- }
- }
- double moneyLeft = budget - bill;
- if (moneyLeft >= 0)
- {
- Console.WriteLine($"Hey, you have a great garden with {flowerCount} {flowerType} and {moneyLeft:f2} leva left.");
- }
- else
- {
- Console.WriteLine($"Not enough money, you need {(moneyLeft * -1):F2} leva more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement