petaryankov00

Fishing Boat

May 9th, 2020
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.25 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Demo1
  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 countFishermans = int.Parse(Console.ReadLine());
  12.             double rent = 0;
  13.             if (season == "Spring")
  14.             {
  15.                 rent = 3000;
  16.                 if (countFishermans <=6)
  17.                 {
  18.                     rent = rent * 0.9;
  19.                 }
  20.                 else if (countFishermans >=7 && countFishermans <=11)
  21.                 {
  22.                     rent = rent * 0.85;
  23.                 }
  24.                 else if (countFishermans >=12)
  25.                 {
  26.                     rent = rent * 0.75;
  27.                 }
  28.  
  29.             }
  30.             else if (season == "Summer" || season == "Autumn")
  31.             {
  32.                 rent = 4200;
  33.                 if (countFishermans <= 6)
  34.                 {
  35.                     rent = rent * 0.9;
  36.                 }
  37.                 else if (countFishermans >= 7 && countFishermans <= 11)
  38.                 {
  39.                     rent = rent * 0.85;
  40.                 }
  41.                 else if (countFishermans >= 12)
  42.                 {
  43.                     rent = rent * 0.75;
  44.                 }
  45.             }
  46.             else if (season == "Winter")
  47.             {
  48.                 rent = 2600;
  49.                 if (countFishermans <= 6)
  50.                 {
  51.                     rent = rent * 0.9;
  52.                 }
  53.                 else if (countFishermans >= 7 && countFishermans <= 11)
  54.                 {
  55.                     rent = rent * 0.85;
  56.                 }
  57.                 else if (countFishermans >= 12)
  58.                 {
  59.                     rent = rent * 0.75;
  60.                 }
  61.             }
  62.  
  63.             if (countFishermans % 2 == 0 && season != "Autumn")
  64.             {
  65.                 rent = rent * 0.95;
  66.             }
  67.  
  68.             if (budget > rent)
  69.             {
  70.                 Console.WriteLine($"Yes! You have {(budget - rent):F2} leva left.");
  71.             }
  72.             else
  73.             {
  74.                 Console.WriteLine($"Not enough money! You need {(rent-budget):F2} leva.");
  75.             }
  76.              
  77.         }
  78.     }
  79. }
Add Comment
Please, Sign In to add comment