Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
141
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.  
  3. namespace FishingBoat
  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 peopleCount = int.Parse(Console.ReadLine());
  12.             decimal price = 0m;
  13.            
  14.             switch(season)
  15.             {
  16.                 case "Spring":
  17.                     price = 3000m;
  18.                     break;
  19.  
  20.                 case "Summer":
  21.                     price = 4200m;
  22.                     break;
  23.                 case "Autumn":
  24.                     price = 4200m;
  25.                     break;
  26.                 case "Winter":
  27.                     price = 2600m;
  28.                     break;
  29.             }
  30.             if (peopleCount<=6)
  31.             {
  32.                 price *= 0.90m;
  33.             }
  34.             else if (peopleCount>=7 && peopleCount<=11)
  35.             {
  36.                 price *= 0.85m;
  37.             }
  38.             else if (peopleCount>12)
  39.             {
  40.                 price = price - (price * 0.25m);
  41.             }
  42.             decimal totalPrice = price;
  43.             if (season == "Spring" && season=="Summer" && season=="Winter" && peopleCount % 2 == 0)
  44.             {
  45.                 price = totalPrice - (totalPrice * 0.95m);
  46.             }
  47.            
  48.             if (price > budget)
  49.             {
  50.                 Console.WriteLine($"Not enough money! You need {(price - budget):f2} leva.");
  51.             }
  52.             else
  53.             {
  54.                 Console.WriteLine($"Yes! You have {(budget-price):f2} leva left.");
  55.             }
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement