Advertisement
Vladimir76

New house

Oct 6th, 2020
1,521
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.36 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string flower = Console.ReadLine();
  14.             int numberFlowers = int.Parse(Console.ReadLine());
  15.             decimal budget = decimal.Parse(Console.ReadLine());
  16.             decimal priceEnd = 0m;
  17.             decimal balance = 0m;
  18.             decimal priceRoses = 5m;
  19.             decimal priceDahlias = 3.80m;
  20.             decimal priceTulips = 2.80m;
  21.             decimal priceNarcissus = 3m;
  22.             decimal priceGladiolus = 2.5m;
  23.  
  24.             if (numberFlowers>=10 && numberFlowers<=1000
  25.                 && budget>=50 && budget<=2500)
  26.             {
  27.                
  28.                 if (flower=="Roses" && numberFlowers>80)
  29.                 {
  30.                     priceEnd = numberFlowers * priceRoses * 0.9m;
  31.                     balance = budget - priceEnd;
  32.                     if (balance >= 0)
  33.                     {
  34.                         Console.WriteLine("Hey, you have a great garden " +
  35.                         "with {0} Roses and {1:f2} leva left.",
  36.                         numberFlowers,Math.Abs(balance));
  37.                     }
  38.                     else
  39.                     {
  40.                         Console.WriteLine("Not enough money, you need " +
  41.                             "{0:f2} leva more.", Math.Abs(balance));
  42.                     }
  43.                    
  44.                 }
  45.                 else if (flower=="Roses" && numberFlowers<=80)
  46.                 {
  47.                     priceEnd = numberFlowers * priceRoses;
  48.                     balance = budget - priceEnd;
  49.                     if (balance>=0)
  50.                     {
  51.                         Console.WriteLine("Hey, you have a great garden " +
  52.                         "with {0} Roses and {1:f2} leva left.",
  53.                         numberFlowers, Math.Abs(balance));
  54.                     }
  55.                     else
  56.                     {
  57.                         Console.WriteLine("Not enough money, you need " +
  58.                             "{0:f2} leva more.", Math.Abs(balance));
  59.                     }
  60.                 }
  61.                 else if (flower=="Dahlias" && numberFlowers>90)
  62.                 {
  63.  
  64.                 }
  65.             }
  66.         }
  67.     }
  68. }
  69.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement