Advertisement
silvana1303

new house

Mar 29th, 2020
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.37 KB | None | 0 0
  1. using System;
  2.  
  3. namespace homeworkconditional
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string flowerType = Console.ReadLine();
  10.             var flowerCount = int.Parse(Console.ReadLine());
  11.             var budget = int.Parse(Console.ReadLine());
  12.             double rosePrice = 5.0;
  13.             double dahliasPrice = 3.8;
  14.             double tulipPrice = 2.8;
  15.             double narcissusPrice = 3.0;
  16.             double gladiolusPrice = 2.5;
  17.  
  18.             var bill = 0.0;
  19.  
  20.             if (flowerType == "Roses" )
  21.             {
  22.                 bill = (flowerCount * rosePrice);
  23.  
  24.                 if (flowerCount > 80)
  25.                 {
  26.                     bill = (flowerCount * rosePrice) * 0.90;
  27.                 }
  28.                
  29.  
  30.             }
  31.             else if (flowerType == "Dahlias" )
  32.             {
  33.                 bill = (flowerCount * dahliasPrice);
  34.  
  35.                 if (flowerCount > 90)
  36.                 {
  37.                     bill = (flowerCount * dahliasPrice) * 0.85;
  38.                 }
  39.                
  40.  
  41.             }
  42.             else if (flowerType == "Tulips")
  43.             {
  44.                 bill = (flowerCount * tulipPrice);
  45.  
  46.                 if (flowerCount > 80)
  47.                 {
  48.                     bill = (flowerCount * tulipPrice) * 0.85;
  49.                 }
  50.                
  51.             }
  52.             else if (flowerType == "Narcissus" )
  53.             {
  54.                 bill = (flowerCount * narcissusPrice);
  55.  
  56.                 if (flowerCount < 120)
  57.                 {
  58.                     bill = (flowerCount * narcissusPrice) * 1.15;
  59.                 }
  60.                
  61.  
  62.             }
  63.             else if (flowerType == "Gladiolus" )
  64.             {
  65.                 bill = (flowerCount * gladiolusPrice);
  66.  
  67.                 if (flowerCount < 80)
  68.                 {
  69.                    bill = (flowerCount * gladiolusPrice) * 1.20;
  70.                 }
  71.                
  72.  
  73.             }
  74.  
  75.             double moneyLeft = budget - bill;
  76.  
  77.             if (moneyLeft >= 0)
  78.             {
  79.                 Console.WriteLine($"Hey, you have a great garden with {flowerCount} {flowerType} and {moneyLeft:f2} leva left.");
  80.             }
  81.             else
  82.             {
  83.                 Console.WriteLine($"Not enough money, you need {(moneyLeft * -1):F2} leva more.");
  84.             }
  85.  
  86.  
  87.  
  88.         }
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement