Advertisement
emodev

fishing

Jan 28th, 2019
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.71 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 fishboats
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             int budget = int.Parse(Console.ReadLine());
  15.             string season = Console.ReadLine();
  16.             int countfishermen = int.Parse(Console.ReadLine());
  17.  
  18.             double price = 0;
  19.          
  20.  
  21.             switch (season)
  22.             {
  23.                 case "Spring":
  24.  
  25.                     price = 3000;
  26.                     break;
  27.  
  28.                 case "Summer":
  29.  
  30.                     price = 4200;
  31.                     break;
  32.  
  33.                 case "Autumn":
  34.  
  35.                     price = 4200;
  36.                     break;
  37.  
  38.                 case "Winter":
  39.  
  40.                     price = 2600;
  41.                     break;
  42.             }
  43.  
  44.             if (countfishermen <= 6)
  45.             {
  46.                 price = price - price * 0.1;
  47.             }
  48.             else if (countfishermen >= 7 && countfishermen <= 11)
  49.             {
  50.                 price = price - price * 0.15;
  51.             }
  52.             else if (countfishermen >= 12)
  53.             {
  54.                 price = price - price * 0.25;
  55.             }
  56.  
  57.  
  58.             if (countfishermen % 2 == 0 && season != "Autumn")
  59.             {
  60.                 price = price - price * 0.05;
  61.             }
  62.            
  63.  
  64.             if (budget >= price)
  65.             {
  66.                 Console.WriteLine($"Yes! You have {(budget - price):f2} leva left.");
  67.             }
  68.             else
  69.             {
  70.                 Console.WriteLine($"Not enough money! You need {(price - budget):f2} leva.");
  71.             }
  72.  
  73.  
  74.         }
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement