Advertisement
VladoG

[PB] TEST-Exam 2017-03-11- 03-Flowers

Mar 12th, 2017
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.21 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 _03_Flowers_2016_12
  8.     {
  9.     class ProgramFlowers
  10.         {
  11.         static void Main(string[] args)
  12.             {
  13.             int hrizantemi = int.Parse(Console.ReadLine());
  14.             int rozi = int.Parse(Console.ReadLine());
  15.             int laleta = int.Parse(Console.ReadLine());
  16.  
  17.             string sezon = Console.ReadLine().ToLower();
  18.             char praznik = char.Parse(Console.ReadLine().ToLower());
  19.  
  20.             double hriznatemiPrice = 0.00, roziPrice = 0.00, laletaPrice = 0.00;
  21.             double bouquetPrice = 0.00;
  22.  
  23.             switch (sezon)
  24.                 {
  25.                 case "spring":
  26.                 case "summer":
  27.                     hriznatemiPrice = 2.00;
  28.                     roziPrice = 4.10;
  29.                     laletaPrice = 2.50;
  30.                     if (praznik == 'y')
  31.                         {
  32.                         hriznatemiPrice *= 1.15;
  33.                         roziPrice *= 1.15;
  34.                         laletaPrice *= 1.15;
  35.                         }
  36.                     break;
  37.                 case "autumn":
  38.                 case "winter":
  39.                     hriznatemiPrice = 3.75;
  40.                     roziPrice = 4.50;
  41.                     laletaPrice = 4.15;
  42.                     if (praznik == 'y')
  43.                         {
  44.                         hriznatemiPrice *= 1.15;
  45.                         roziPrice *= 1.15;
  46.                         laletaPrice *= 1.15;
  47.                         }
  48.                     break;
  49.                 }
  50.             bouquetPrice = hrizantemi * hriznatemiPrice + rozi * roziPrice + laleta * laletaPrice;
  51.  
  52.             if (laleta > 7 && sezon == "spring")
  53.                 {
  54.                 bouquetPrice *= 0.95;
  55.                 }
  56.             if (rozi >= 10 && sezon == "winter")
  57.                 {
  58.                 bouquetPrice *= 0.90;
  59.                 }
  60.             if ((hrizantemi + rozi + laleta) > 20)
  61.                 {
  62.                 bouquetPrice *= 0.80;
  63.                 }
  64.  
  65.             bouquetPrice += 2.00;
  66.  
  67.             Console.WriteLine("{0:F2}", bouquetPrice);
  68.             }
  69.         }
  70.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement