Advertisement
M0Hk

Fishing Boat

Sep 22nd, 2023
773
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 KB | Software | 0 0
  1. using System;
  2. using System.Diagnostics.Metrics;
  3.  
  4. namespace firstLesson
  5. {
  6.     internal class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int budget = int.Parse(Console.ReadLine());
  11.             string season = Console.ReadLine();
  12.             int counting = int.Parse(Console.ReadLine());
  13.  
  14.             double price = 0;
  15.  
  16.             switch (season)
  17.             {
  18.                 case "Spring": price = 3000; break;
  19.                 case "Summer":
  20.                 case "Autumn": price = 4200; break;
  21.                 case "Winter": price = 2600; break;
  22.             }
  23.             if (counting <= 6)
  24.             {
  25.                 price = price * 0.9;
  26.             }
  27.             else if (counting >= 7 && counting <= 11)
  28.             {
  29.                 price = price * 0.85;
  30.             }
  31.             else if (counting >= 12 )
  32.             {
  33.                 price = price * 0.75;
  34.             }
  35.             if(counting % 2 == 0 && season != "Autumn")
  36.             {
  37.                 price = price * 0.95;
  38.             }
  39.             if (price <= budget)
  40.                 Console.WriteLine($"Yes! You have {(budget - price):F2} leva left.");
  41.             else
  42.                 Console.WriteLine($"Not enough money! You need {(price - budget):F2} leva.");
  43.  
  44.         }
  45.     }
  46. }
Tags: Fishing Boat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement