Advertisement
denitsas01

Untitled

Mar 29th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.49 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 finalCurrentPrice = 0.00;
  17.             double currentPrice = 0.00;
  18.  
  19.             if (season == "spring") currentPrice = 3000;
  20.             else if (season == "summer" || season == "autumn") currentPrice = 4200;
  21.             else if (season == "winter") currentPrice = 2600;
  22.  
  23.             if (fishmen <= 6) finalCurrentPrice = currentPrice - currentPrice * 0.1;
  24.             else if (fishmen > 7 && fishmen <= 11) finalCurrentPrice = currentPrice - currentPrice * 0.15;
  25.             else if (fishmen > 12) finalCurrentPrice = currentPrice - currentPrice * 0.25;
  26.  
  27.             if (fishmen % 2 == 0 && season != "autumn") finalCurrentPrice = currentPrice - (currentPrice * 0.05);
  28.             else finalCurrentPrice = currentPrice;
  29.  
  30.  
  31.             if (finalCurrentPrice <= budget)
  32.             {
  33.                 Console.WriteLine($"Yes! You have ($"{ budget - finalCurrentPrice:F2}") leva left.");
  34.             }
  35.             else
  36.             {
  37.                 Console.WriteLine($"Not enough money! You need $"{ Math.Abs(budget - finalCurrentPrice)} " leva.");
  38.             }
  39.  
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement