Advertisement
IvetValcheva

03. New House

Nov 15th, 2021
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.24 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string flowersType = Console.ReadLine();
  10.             int flowersCount = int.Parse(Console.ReadLine());
  11.             int budget = int.Parse(Console.ReadLine());
  12.  
  13.             double price = 0.00;
  14.  
  15.             if (flowersType== "Roses")
  16.             {
  17.                 //"Roses" = 5.00 => > 80 - 10 % отстъпка
  18.                 price = flowersCount * 5.00;
  19.                 if (flowersCount > 80)
  20.                 {
  21.                     price = price - price * 0.10;
  22.                 }
  23.             }
  24.             else if(flowersType == "Dahlias")
  25.             {
  26.                 //"Dahlias"=3.80,  => >90 - 15% отстъпка
  27.                 price = flowersCount * 3.80;
  28.                 if (flowersCount > 90)
  29.                 {
  30.                     price = price - price * 0.15;
  31.                 }
  32.             }
  33.             else if (flowersType == "Tulips")
  34.             {
  35.                 //"Tulips"=2.80,  => >80 - 15% отстъпка
  36.                 price = flowersCount * 2.80;
  37.                 if (flowersCount > 80)
  38.                 {
  39.                     price = price - price * 0.15;
  40.                 }
  41.             }
  42.             else if (flowersType == "Narcissus")
  43.             {
  44.                 //"Narcissus"=3.00,  => <120 оскъпява с 15%
  45.                 price = flowersCount * 3.00;
  46.                 if (flowersCount < 120)
  47.                 {
  48.                     price = price + price * 0.15;
  49.                 }
  50.             }
  51.             else if (flowersType == "Gladiolus")
  52.             {
  53.                 //"Gladiolus"=2.50  => <80 оскъпява с 20%
  54.                 price = flowersCount * 2.50;
  55.                 if (flowersCount < 80)
  56.                 {
  57.                     price = price + price * 0.20;
  58.                 }
  59.             }
  60.  
  61.             if (budget < price)
  62.             {
  63.                 Console.WriteLine($"Not enough money, you need {(price-budget):F2} leva more.");
  64.             }
  65.             else
  66.             {
  67.                 Console.WriteLine($"Hey, you have a great garden with {flowersCount} {flowersType} and {(budget-price):F2} leva left.");
  68.             }
  69.         }
  70.     }
  71. }
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement