Yachkov

new house infinished

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