kalitarix

NewHouse

Oct 4th, 2018
1,048
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.94 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 flowerType = Console.ReadLine();
  10.             int amountOfFlowers = int.Parse(Console.ReadLine());
  11.             int budget = int.Parse(Console.ReadLine());
  12.  
  13.             double price = 0;
  14.  
  15.             if (flowerType == "Roses")
  16.             {
  17.                 price = amountOfFlowers * 5;
  18.  
  19.                 if (amountOfFlowers > 80)
  20.                 {
  21.                     price *= 0.9;  
  22.                 }
  23.             }
  24.             else if (flowerType == "Dahlias")
  25.             {
  26.                 price = amountOfFlowers * 3.8;
  27.  
  28.                 if (amountOfFlowers > 90)
  29.                 {
  30.                     price *= 0.85;
  31.                 }
  32.             }
  33.             else if (flowerType == "Tulips")
  34.             {
  35.                 price = amountOfFlowers * 2.8;
  36.  
  37.                 if (amountOfFlowers > 80)
  38.                 {
  39.                     price *= 0.85;
  40.                 }
  41.             }
  42.             else if (flowerType == "Narcissus")
  43.             {
  44.                 price = amountOfFlowers * 3;
  45.  
  46.                 if (amountOfFlowers < 120)
  47.                 {
  48.                     price += (price * 0.15);
  49.                 }
  50.             }
  51.             else if (flowerType == "Gladiolus")
  52.             {
  53.                 price = amountOfFlowers * 2.50;
  54.  
  55.                 if (amountOfFlowers < 80)
  56.                 {
  57.                     price += (price * 0.20);
  58.                 }
  59.             }
  60.  
  61.             double difference = Math.Abs(budget - price);
  62.  
  63.             if (budget >= price)
  64.             {
  65.                 Console.WriteLine($"Hey, you have a great garden with {amountOfFlowers} {flowerType} and {difference:f2} leva left.");
  66.             }
  67.             else
  68.             {
  69.                 Console.WriteLine($"Not enough money, you need {difference:f2} leva more.");
  70.             }
  71.         }
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment