Advertisement
Terziyski

Flowers

Mar 12th, 2017
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.15 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 Problem03_Flowers
  8. {
  9.     class Flowers
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int hrizantems = int.Parse(Console.ReadLine());
  14.             int rozes = int.Parse(Console.ReadLine());
  15.             int tulips = int.Parse(Console.ReadLine());
  16.             string season = Console.ReadLine().ToLower();
  17.             string holiday = Console.ReadLine().ToLower();
  18.  
  19.             double totalPrice = 1;
  20.             double totalFlowers = hrizantems + rozes + tulips;
  21.  
  22.             if (season == "spring" || season == "summer")
  23.             {
  24.                 double priceHrizantems = hrizantems * 2.00;
  25.                 double priceRozes = rozes * 4.10;
  26.                 double priceTulips = tulips * 2.50;
  27.                 if (holiday == "y")
  28.                 {
  29.                     totalPrice = (priceHrizantems + priceRozes + priceTulips) * 1.15;
  30.                 }
  31.                 else
  32.                 {
  33.                     totalPrice = priceHrizantems + priceRozes + priceTulips;
  34.                 }
  35.                 if (tulips > 7)
  36.                 {
  37.                     totalPrice *= 0.95;
  38.                 }
  39.             }
  40.             else
  41.             {
  42.                 double priceHrizantems = hrizantems * 3.75;
  43.                 double priceRozes = rozes * 4.50;
  44.                 double priceTulips = tulips * 4.15;
  45.                 if (holiday == "y")
  46.                 {
  47.                     totalPrice = (priceHrizantems + priceRozes + priceTulips) * 1.15;
  48.                 }
  49.                 else
  50.                 {
  51.                     totalPrice = priceHrizantems + priceRozes + priceTulips;
  52.                 }
  53.                 if (rozes >= 10 && season == "winter")
  54.                 {
  55.                     totalPrice *= 0.90;
  56.                 }
  57.  
  58.             }
  59.             if (totalFlowers > 20)
  60.             {
  61.                 totalPrice *= 0.80;
  62.             }
  63.            
  64.             double arranging = totalPrice + 2.00;
  65.             Console.WriteLine("{0:F2}",Math.Round(arranging, 2));
  66.         }
  67.  
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement