Advertisement
Guest User

Fishing Boat

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