anizko

05. Fishing Boat

Apr 1st, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.55 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Fishing_Boat
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double Budget = double.Parse(Console.ReadLine());
  10.             string Season = Console.ReadLine();
  11.             double CountFisher = double.Parse(Console.ReadLine());
  12.  
  13.             double PriceBoat = 0;
  14.  
  15.             if (Season== "Spring")
  16.             {
  17.                 PriceBoat = 3000;
  18.                 if (CountFisher<=6)
  19.                 {
  20.                     PriceBoat = PriceBoat - (PriceBoat * 10 / 100);
  21.                 }
  22.                 else if (CountFisher <= 11&& CountFisher >= 7)
  23.                 {
  24.                     PriceBoat = PriceBoat - (PriceBoat * 15 / 100);
  25.                 }
  26.                 else if (CountFisher >= 12)
  27.                 {
  28.                     PriceBoat = PriceBoat - (PriceBoat * 25 / 100);
  29.                 }
  30.  
  31.             }
  32.  
  33.             else if (Season == "Summer"||Season == "Autumn")
  34.             {
  35.                 PriceBoat = 4200;
  36.                 if (CountFisher <= 6)
  37.                 {
  38.                     PriceBoat = PriceBoat - (PriceBoat * 10 / 100);
  39.                 }
  40.                 else if (CountFisher <= 11 && CountFisher >= 7)
  41.                 {
  42.                     PriceBoat = PriceBoat - (PriceBoat * 15 / 100);
  43.                 }
  44.                 else if (CountFisher >= 12)
  45.                 {
  46.                     PriceBoat = PriceBoat - (PriceBoat * 25 / 100);
  47.                 }
  48.  
  49.             }
  50.             else if (Season == "Winter")
  51.             {
  52.                 PriceBoat = 2600;
  53.                 if (CountFisher <= 6)
  54.                 {
  55.                     PriceBoat = PriceBoat - (PriceBoat * 10 / 100);
  56.                 }
  57.                 else if (CountFisher <= 11 && CountFisher >= 7)
  58.                 {
  59.                     PriceBoat = PriceBoat - (PriceBoat * 15 / 100);
  60.                 }
  61.                 else if (CountFisher >= 12)
  62.                 {
  63.                     PriceBoat = PriceBoat - (PriceBoat * 25 / 100);
  64.                 }
  65.  
  66.             }
  67.  
  68.             if (Season != "Autumn"&& CountFisher%2==0)
  69.             {
  70.                 PriceBoat = PriceBoat - (PriceBoat * 5 / 100);
  71.             }
  72.             double Money = Math.Abs(Budget - PriceBoat);
  73.  
  74.             if(Budget>= PriceBoat)
  75.             {
  76.                 Console.WriteLine($"Yes! You have {Money:f2} leva left.");
  77.             }
  78.             else
  79.             {
  80.                 Console.WriteLine($"Not enough money! You need {Money:f2} leva.");
  81.             }
  82.  
  83.            
  84.         }
  85.     }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment