Advertisement
MeglenaLazarova

Untitled

Sep 17th, 2023
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 KB | None | 0 0
  1. namespace _04._Fishing_Boat
  2. {
  3.     internal class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.           int budget = int.Parse(Console.ReadLine());
  8.           string season = Console.ReadLine();
  9.           int fisherman = int.Parse(Console.ReadLine());
  10.  
  11.           double boat = 0;
  12.          
  13.  
  14.            
  15.             switch (season)
  16.             {
  17.                 case "Spring":
  18.                     boat = 3000;
  19.                     break;
  20.  
  21.                 case "Summer":
  22.                     boat = 4200;
  23.                     break;
  24.  
  25.                 case "Autumn":
  26.                     boat = 4200;
  27.                     break;
  28.  
  29.                 case "Winter":
  30.                     boat = 2600;
  31.                     break;
  32.             }
  33.             if (fisherman <= 6)
  34.             {
  35.                 boat = boat * 0.90;
  36.                
  37.             }
  38.             else if (fisherman >= 7 && fisherman <= 11)
  39.             {
  40.                 boat = boat * 0.85;
  41.                
  42.             }
  43.             else if (fisherman >= 12)
  44.             {
  45.                 boat = boat * 0.75;
  46.                
  47.             }
  48.             if (fisherman % 2 == 0 && !season.Equals("Autumn") )
  49.             {
  50.                 boat = boat * 0.95;
  51.             }
  52.             if (budget >= boat)
  53.             {
  54.                 double left = budget - boat;
  55.                 Console.WriteLine($"Yes! You have {left:f2} leva left.");
  56.             }
  57.             else
  58.             {
  59.                 double need = boat - budget;
  60.                 Console.WriteLine($"Not enough money! You need {need:f2} leva.");
  61.             }
  62.         }
  63.     }
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement