Advertisement
denitsas01

Untitled

Mar 29th, 2019
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.93 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 FishingBoat
  8. {
  9.     class FishingBoat
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double budget = double.Parse(Console.ReadLine());
  14.             string season = Console.ReadLine();
  15.             int fishmen = int.Parse(Console.ReadLine());
  16.             double currentPrice = 0.00;
  17.             double finalCurrentPrice = 0.00;
  18.  
  19.             if (season == "spring")
  20.             {
  21.                 if (fishmen <= 6) currentPrice = 3000 - 3000 * 0.1;
  22.                 else if (fishmen >= 7 && fishmen <= 11) currentPrice = 3000 - 3000 * 0.15;
  23.                 else if (fishmen > 12) currentPrice = 3000 - 3000 * 0.25;
  24.             }
  25.             else if (season == "summer" || season == "autumn")
  26.             {
  27.                 if (fishmen <= 6) currentPrice = 4200 - 4200 * 0.1;
  28.                 else if (fishmen >= 7 && fishmen <= 11) currentPrice = 4200 - 4200 * 0.15;
  29.                 else if (fishmen > 12) currentPrice = 4200 - 4200 * 0.25;
  30.             }
  31.             else if (season == "winter")
  32.             {
  33.                 if (fishmen <= 6) currentPrice = 2600 - 2600 * 0.1;
  34.                 else if (fishmen >= 7 && fishmen <= 11) currentPrice = 2600 - 2600 * 0.15;
  35.                 else if (fishmen > 12) currentPrice = 2600 - 2600 * 0.25;
  36.             }
  37.  
  38.             if (fishmen % 2 == 0 && season != "autumn") finalCurrentPrice = currentPrice - (currentPrice * 0.05);
  39.             else finalCurrentPrice = currentPrice;
  40.  
  41.  
  42.             if (finalCurrentPrice <= budget)
  43.             {
  44.                 Console.WriteLine($"Yes! You have {Math.Round((budget - finalCurrentPrice),2)} leva left.");
  45.             }
  46.             else
  47.             {
  48.                 Console.WriteLine($"Not enough money! You need {Math.Round((finalCurrentPrice - budget),2)} leva.");
  49.             }
  50.  
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement