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 Flowers1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int hrizantemCount = int.Parse(Console.ReadLine());
- int roseCount = int.Parse(Console.ReadLine());
- int tulipCount = int.Parse(Console.ReadLine());
- string season = Console.ReadLine();
- bool isHolyday = Console.ReadLine() == "Y";
- double flowerCost = 0;
- if (season == "Spring" || season == "Summer")
- {
- flowerCost =
- hrizantemCount * 2 +
- roseCount * 4.1 +
- tulipCount * 2.5;
- if (tulipCount > 7 && season == "Spring")
- {
- flowerCost *= 0.95;
- }
- }
- else
- {
- flowerCost =
- hrizantemCount * 3.75 +
- roseCount * 4.5 +
- tulipCount * 4.15;
- if (roseCount >= 10 && season == "Winter")
- flowerCost *= 0.9;
- }
- if (isHolyday)
- flowerCost *= 1.15;
- if (hrizantemCount + roseCount + tulipCount > 20)
- flowerCost *= 0.8;
- flowerCost += 2;
- Console.WriteLine($"{flowerCost:f2}");
- }
- }
- }
- /*
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Flowers
- {
- class Program
- {
- static void Main(string[] args)
- {
- double quantityChris = int.Parse(Console.ReadLine());
- double quantityRoses = int.Parse(Console.ReadLine());
- double quantityTulip = int.Parse(Console.ReadLine());
- string season = Console.ReadLine();
- string holiday = Console.ReadLine();
- var count = quantityTulip + quantityRoses + quantityChris;
- double priceFlowers = 0;
- switch (season)
- {
- case "Summer":
- quantityChris = 2.00 * quantityChris;
- quantityRoses = 4.10 * quantityRoses;
- quantityTulip = 2.50 * quantityTulip;
- break;
- case "Spring":
- quantityChris = 2.00 * quantityChris;
- quantityRoses = 4.10 * quantityRoses;
- quantityTulip = 2.50 * quantityTulip;
- break;
- case "Autumn":
- quantityChris = 3.75 * quantityChris;
- quantityRoses = 4.50 * quantityRoses;
- quantityTulip = 4.15 * quantityTulip;
- break;
- case "Winter":
- quantityChris = 3.75 * quantityChris;
- quantityRoses = 4.50 * quantityRoses;
- quantityTulip = 4.15 * quantityTulip;
- break;
- }
- priceFlowers = (quantityChris + quantityRoses + quantityTulip);
- if (holiday == "Y")
- priceFlowers *= 1.15;
- if ( (quantityTulip >= 7) || (quantityRoses >= 10) )
- if (season == "Spring")
- priceFlowers *= 0.95;
- if (season == "Winter")
- priceFlowers *= 0.9;
- if (count > 20)
- priceFlowers *= 0.8;
- Console.WriteLine("{0:f2}", priceFlowers+2 );
- }
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment