Advertisement
MARINA_GREBENAROVA

New_House

Sep 28th, 2021
927
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.75 KB | None | 0 0
  1. using System;
  2.  
  3. namespace New_House
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string flower = Console.ReadLine();
  10.             double countFlower = double.Parse(Console.ReadLine());
  11.             double budget = double.Parse(Console.ReadLine());
  12.  
  13.             double rosesPrice = 5;
  14.             double dahliasPrice = 3.80;
  15.             double tulipsPrice = 2.80;
  16.             double narcissusPrice = 3;
  17.             double gladiolusPrice = 2.50;
  18.  
  19.             double price = 0;
  20.  
  21.             if (flower == "Roses")
  22.             {
  23.                 if (countFlower > 80)
  24.                 {
  25.                     double rosesM = countFlower * rosesPrice;
  26.                     price = rosesM - (rosesM * 0.1);
  27.                 }
  28.                 else
  29.                 {
  30.                     price = countFlower * rosesPrice;
  31.                 }
  32.             }
  33.             if (flower=="Dahlias")
  34.             {
  35.                 if (countFlower>90)
  36.                 {
  37.                     double dahliasM = countFlower * dahliasPrice;
  38.                     price = dahliasM - (dahliasM * 0.15);
  39.                 }
  40.                 else
  41.                 {
  42.                     price = countFlower * dahliasPrice;
  43.                 }
  44.             }
  45.             if (flower=="Tulips")
  46.             {
  47.                 if (countFlower>80)
  48.                 {
  49.                     double tulipsM = countFlower * tulipsPrice;
  50.                     price = tulipsM - (tulipsM * 0.15);
  51.                 }
  52.                 else
  53.                 {
  54.                     price = countFlower * tulipsPrice;
  55.                 }
  56.             }
  57.             if (flower=="Narcissus")
  58.             {
  59.                 if (countFlower<120)
  60.                 {
  61.                     double narcM = countFlower * narcissusPrice;
  62.                     price = narcM + (narcM * 0.15);
  63.                 }
  64.                 else
  65.                 {
  66.                     price = countFlower * narcissusPrice;
  67.                 }
  68.             }
  69.             if (flower=="Gladiolus")
  70.             {
  71.                 if (countFlower<80)
  72.                 {
  73.                     double gladiolusM = countFlower * gladiolusPrice;
  74.                     price = gladiolusM + (gladiolusM * 0.20);
  75.                 }
  76.                 else
  77.                 {
  78.                     price = countFlower * gladiolusPrice;
  79.                 }
  80.             }
  81.             if (price>budget)
  82.             {
  83.                 Console.WriteLine($"Not enough money, you need {price-budget:F2} leva more.");
  84.             }
  85.             else
  86.             {
  87.                 Console.WriteLine($"Hey, you have a great garden with {countFlower} {flower} and {budget-price:F2} leva left.");
  88.             }
  89.  
  90.  
  91.  
  92.         }
  93.     }
  94. }
  95.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement