Advertisement
bokoto83

03.Flowers

Jun 26th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Flowers
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int numberChrysanthemums = int.Parse(Console.ReadLine());
  14.             int numberRoses = int.Parse(Console.ReadLine());  
  15.             int numberTulips = int.Parse(Console.ReadLine());
  16.             string season = Console.ReadLine();
  17.             string holiday = Console.ReadLine();
  18.             double chrysanthemums = 0;
  19.             double roses = 0;
  20.             double tulips = 0;
  21.             double totalFlowers = 0;
  22.             double price = 0;
  23.             totalFlowers = numberTulips + numberRoses + numberChrysanthemums;
  24.  
  25.  
  26.             if (season == "Spring" || season == "Summer")
  27.             {
  28.                 chrysanthemums = 2.00 * numberChrysanthemums;
  29.                 roses = 4.10 * numberRoses;
  30.                 tulips = 2.50 * numberTulips;
  31.             }
  32.  
  33.             else if (season == "Аutumn" || season == "Winter")
  34.             {
  35.                 chrysanthemums = 3.75 * numberChrysanthemums;
  36.                 roses = 4.50 * numberRoses;
  37.                 tulips = 4.15 * numberTulips;
  38.             }
  39.  
  40.             price = chrysanthemums + roses + tulips;
  41.  
  42.  
  43.             if (holiday == "Y")
  44.             {
  45.                 price = price + price * 0.15;
  46.             }
  47.  
  48.             if (season == "Spring" && numberTulips > 7)
  49.             {
  50.                 price = price - price * 0.05;
  51.             }
  52.             if (season == "Winter" && numberRoses >= 10)
  53.             {
  54.                 price = price - price * 0.10;
  55.             }
  56.             if (totalFlowers >= 20)
  57.             {
  58.                 price = price - price * 0.20;
  59.             }
  60.  
  61.             price = price + 2;
  62.  
  63.  
  64.             Console.WriteLine($"{price:f2}");
  65.  
  66.         }
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement