Advertisement
clipro

Untitled

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