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 flowers_2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int chrysantemums = int.Parse(Console.ReadLine());
- int roses = int.Parse(Console.ReadLine());
- int tulips = int.Parse(Console.ReadLine());
- string season = Console.ReadLine();
- bool isHoliday = Console.ReadLine() == "Y" ? true : false;
- int totalFlowers = chrysantemums + roses + tulips;
- double totalPrice;
- bool flowersMoreThanTwenty = totalFlowers >= 20;
- if (season == "Spring" || season == "Summer")
- {
- totalPrice = chrysantemums * 2 + roses * 4.1 + tulips * 2.5;
- bool tulipDiscount = tulips > 7 && season == "Spring";
- if (isHoliday)
- {
- totalPrice *= 1.15;
- }
- if (tulipDiscount)
- {
- totalPrice *= 0.95;
- }
- }
- else
- {
- totalPrice = chrysantemums * 3.75 + roses * 4.5 + tulips *4.15;
- bool roseDiscount = roses >= 10 && season == "Winter";
- if (isHoliday)
- {
- totalPrice *= 1.15;
- }
- if (roseDiscount)
- {
- totalPrice *= 0.9;
- }
- }
- if (flowersMoreThanTwenty)
- {
- totalPrice *= 0.8;
- }
- totalPrice+=2;
- Console.WriteLine("{0:f2}",totalPrice);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement