Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _05.FishingBoat
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double budget = int.Parse(Console.ReadLine());
  10.             string season = Console.ReadLine();
  11.             int fisherCount = int.Parse(Console.ReadLine());
  12.  
  13.             double rentBoat = 0;
  14.             int people = 0;
  15.  
  16.  
  17.             if (season == "Spring")
  18.             {
  19.                 rentBoat = 3000;
  20.             }
  21.             else if (season == "Summer" || season == "Autumn")
  22.             {
  23.                 rentBoat = 4200;
  24.             }
  25.             else if (season == "Winter")
  26.             {
  27.                 rentBoat = 2600;
  28.             }
  29.  
  30.             if (people <= 6)
  31.             {
  32.                 budget *= 0.9;
  33.             }
  34.             else if (people >= 7 && people <= 11)
  35.             {
  36.                 budget *= 0.85;
  37.             }
  38.             else
  39.             {
  40.                 budget *= 0.75;
  41.             }
  42.             if (people % 2 == 0 && season != "Autumn")
  43.             {
  44.                 budget *= 0.9;
  45.             }
  46.  
  47.             double totalSum = budget * rentBoat;
  48.             if (totalSum <= budget )
  49.             {
  50.                 Console.WriteLine($"Yes! You have {budget - rentBoat:f2} leva left.");
  51.             }
  52.             else
  53.             {
  54.                 Console.WriteLine($"Not enough money! You need {totalSum:f2} leva.");
  55.             }
  56.                
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement