Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.93 KB | None | 0 0
  1. using System;
  2.  
  3. namespace NewHouse
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string flowers = Console.ReadLine();
  10.             int countsFlowers = int.Parse(Console.ReadLine());
  11.             double budget = double.Parse(Console.ReadLine());
  12.             double price = 0;
  13.             double totalPrice = price * countsFlowers;
  14.  
  15.             switch (flowers)
  16.             {
  17.                 case "Roses":
  18.                     price = 5.0;
  19.                     if ( countsFlowers > 80)
  20.                     {
  21.                         price *= 0.90;
  22.                     }
  23.                     break;
  24.  
  25.                 case "Dahlias":
  26.                     price = 3.80;
  27.                     if (countsFlowers > 90)
  28.                     {
  29.                         price *= 0.85;
  30.                     }
  31.                     break;
  32.  
  33.                 case "Tulips":
  34.                     price = 2.80;
  35.                     if (countsFlowers > 80)
  36.                     {
  37.                         price *= 0.85;
  38.                     }
  39.                     break;
  40.  
  41.                 case "Narcissus":
  42.                     price = 3.00;
  43.                     if (countsFlowers < 120)
  44.                     {
  45.                         price *= 1.15;
  46.                     }
  47.                     break;
  48.  
  49.                 case "Gladiolus":
  50.                     price = 2.50;
  51.                     if (countsFlowers < 80)
  52.                     {
  53.                         price *= 1.20;
  54.                     }
  55.                     break;
  56.  
  57.             }
  58.             if (budget >= totalPrice)
  59.             {
  60.                 Console.WriteLine($"Hey, you have a great garden with {countsFlowers} {flowers} and {budget - totalPrice:f2} leva left.");
  61.             }
  62.             else
  63.             {
  64.                 Console.WriteLine($"Not enough money, you need {budget - totalPrice:f2} leva more.");
  65.             }
  66.         }
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement