Advertisement
YORDAN2347

FishingBoat

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