Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Flowers
- {
- static void Main(string[] args)
- {
- int chrys = int.Parse(Console.ReadLine());
- int roses = int.Parse(Console.ReadLine());
- int tulips = int.Parse(Console.ReadLine());
- string season = Console.ReadLine();
- char isHoliday = char.Parse(Console.ReadLine());
- double cPrice, rPrice, tPrice, seasonalDiscount = 0;
- double totalFlowers = chrys + roses + tulips;
- if (season == "Spring" || season == "Summer")
- {
- cPrice = 2;
- rPrice = 4.10;
- tPrice = 2.50;
- if (tulips > 7 && season == "Spring") seasonalDiscount = 0.05;
- }
- else
- {
- cPrice = 3.75;
- rPrice = 4.50;
- tPrice = 4.15;
- if (roses >= 10 && season == "Winter") seasonalDiscount = 0.1;
- }
- double generalDiscount = (totalFlowers > 20) ? 0.2 : 0;
- double holidayExp = (isHoliday == 'Y') ? 0.15 : 0;
- double totalExpenses = (cPrice * chrys + rPrice * roses + tPrice * tulips);
- double holidayFlowers = totalExpenses + totalExpenses * holidayExp;
- double seasonalExpenses = holidayFlowers - holidayFlowers * seasonalDiscount;
- double generalExpenses = seasonalExpenses - seasonalExpenses * generalDiscount;
- Console.Write((generalExpenses + 2).ToString("F"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment