Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.43 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Пета_задача___Лодка_за_риболов
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int budget = int.Parse(Console.ReadLine());
  10.             string season = Console.ReadLine();
  11.             int fishermans = int.Parse(Console.ReadLine());
  12.             double price = 0;
  13.  
  14.             if (season == "Spring")
  15.             {
  16.                 price = 3000;
  17.             }
  18.             else if (season == "Autumn" || season == "Summer")
  19.             {
  20.                 price = 4200;
  21.             }
  22.             else if (season == "Winter")
  23.             {
  24.                 price = 2600;
  25.             }
  26.             if (fishermans <= 6)
  27.             {
  28.                 price *= 0.9;
  29.             }
  30.             else if (7 <= fishermans && fishermans <= 11)
  31.             {
  32.                 price *= 0.85;
  33.             }
  34.             else if (12 <= fishermans)
  35.             {
  36.                 price *= 0.75;
  37.             }
  38.             if (fishermans % 2 == 0 && season != "Autumn")
  39.             {
  40.                 price *= 0.95;
  41.             }
  42.             if (budget >= price)
  43.             {
  44.                 Console.WriteLine($"Yes! You have {(budget - price):f2} leva left.");
  45.             }
  46.             else if (price > budget)
  47.             {
  48.                 Console.WriteLine($"Not enough money! You need {(price - budget):f2} leva.");
  49.             }
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement