Yachkov

Unfinished Fishing boat

Jan 27th, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.19 KB | None | 0 0
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.ComponentModel.Design;
  4. using System.Globalization;
  5. using System.Reflection;
  6. using System.Runtime.ConstrainedExecution;
  7. using System.Security.Cryptography;
  8.  
  9. namespace SomeExcercises
  10. {
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             int budget = int.Parse(Console.ReadLine());
  16.             string season = Console.ReadLine();
  17.             int fisherMen = int.Parse(Console.ReadLine());
  18.             double rent = 0;
  19.             double finalPrice = 0;
  20.             double discount = double.Parse(Console.ReadLine());
  21.  
  22.  
  23.  
  24.             switch (season)
  25.             {
  26.                 case "Spring":
  27.                     rent = 3000;
  28.                     if (fisherMen <= 6)
  29.                     {
  30.                         finalPrice = rent - (rent * 0.10);
  31.                         finalPrice -= finalPrice * 0.10;
  32.                         if (fisherMen % 2 == 0 && season == "Spring")
  33.                         {
  34.                             finalPrice -= finalPrice * 0.10;
  35.                         }
  36.                         else
  37.                         {
  38.                             finalPrice -= finalPrice * 0.05;
  39.  
  40.                         }
  41.                     }
  42.                     else if (fisherMen >= 7 && fisherMen <= 11)
  43.                     {
  44.                         finalPrice -= finalPrice * 0.15;
  45.                         if (fisherMen % 2 == 0 && season == "Spring")
  46.                         {
  47.                             finalPrice -= finalPrice * 0.15;
  48.                         }
  49.                         else
  50.                         {
  51.                             finalPrice -= finalPrice * 0.05;
  52.  
  53.                         }
  54.  
  55.                     }
  56.                     else if (finalPrice >= 12)
  57.                     {
  58.                         finalPrice -= finalPrice * 0.25;
  59.                         if (fisherMen % 2 == 0 && season == "Spring")
  60.                         {
  61.                             finalPrice -= finalPrice * 0.25;
  62.                         }
  63.                         else
  64.                         {
  65.                             finalPrice -= finalPrice * 0.05;
  66.  
  67.                         }
  68.                     }
  69.  
  70.                     break;
  71.                 //Important
  72.                 case "Summer":
  73.                     rent = 4200;
  74.                     if (fisherMen <= 6)
  75.                     {
  76.                         finalPrice = rent - (rent * 0.15);
  77.                         if (fisherMen % 2 == 0)
  78.                         {
  79.                             finalPrice -= finalPrice * 0.05;
  80.                         }
  81.                         else
  82.                         {
  83.                             finalPrice = finalPrice;
  84.  
  85.                         }
  86.                     }
  87.                     //Important
  88.                     else if (fisherMen >= 7 && fisherMen <= 11)
  89.                     {
  90.                         finalPrice = rent - (rent * 0.15);
  91.                         if (fisherMen % 2 == 0)
  92.                         {
  93.                             finalPrice -= finalPrice * 0.15;
  94.                         }
  95.                         else
  96.                         {
  97.                             finalPrice -= finalPrice * 0.05;
  98.  
  99.                         }
  100.  
  101.                     }
  102.                     else if (finalPrice >= 12)
  103.                     {
  104.                         finalPrice -= finalPrice * 0.25;
  105.                         if (finalPrice % 2 == 0)
  106.                         {
  107.                             finalPrice -= fisherMen * 0.25;
  108.                         }
  109.                         else
  110.                         {
  111.                             finalPrice -= finalPrice * 0.05;
  112.  
  113.                         }
  114.  
  115.                     }
  116.  
  117.                     break;
  118.                 case "Autumn":
  119.                     finalPrice = rent * 4200;
  120.                     rent = 4200;
  121.                     if (fisherMen <= 6)
  122.                     {
  123.                         finalPrice -= finalPrice * 0.10;
  124.                         if (finalPrice % 2 == 0)
  125.                         {
  126.                             finalPrice -= fisherMen * 0.10;
  127.                         }
  128.                         else
  129.                         {
  130.                             finalPrice -= finalPrice * 0.05;
  131.  
  132.                         }
  133.                     }
  134.                     else if (fisherMen >= 7 && fisherMen <= 11)
  135.                     {
  136.                         finalPrice -= finalPrice * 0.15;
  137.                         if (finalPrice % 2 == 0)
  138.                         {
  139.                             finalPrice -= fisherMen * 0.15;
  140.                         }
  141.                         else
  142.                         {
  143.                             finalPrice -= finalPrice * 0.05;
  144.  
  145.                         }
  146.  
  147.                     }
  148.                     else if (finalPrice >= 12)
  149.                     {
  150.                         finalPrice -= finalPrice * 0.25;
  151.                         if (finalPrice % 2 == 0)
  152.                         {
  153.                             finalPrice -= fisherMen * 0.25;
  154.                         }
  155.                         else
  156.                         {
  157.                             finalPrice -= finalPrice * 0.05;
  158.  
  159.                         }
  160.                     }
  161.  
  162.                     break;
  163.                 case "Winter":
  164.                     finalPrice = rent * 2600;
  165.                     rent = 2600;
  166.                     if (fisherMen <= 6)
  167.                     {
  168.                         finalPrice -= finalPrice * 0.10;
  169.                         if (finalPrice % 2 == 0)
  170.                         {
  171.                             finalPrice -= fisherMen * 0.10;
  172.                         }
  173.                         else
  174.                         {
  175.                             finalPrice -= finalPrice * 0.05;
  176.  
  177.                         }
  178.                     }
  179.                     else if (fisherMen >= 7 && fisherMen <= 11)
  180.                     {
  181.                         finalPrice -= finalPrice * 0.15;
  182.                         if (finalPrice % 2 == 0)
  183.                         {
  184.                             finalPrice -= fisherMen * 0.15;
  185.                         }
  186.                         else
  187.                         {
  188.                             finalPrice -= finalPrice * 0.05;
  189.  
  190.                         }
  191.  
  192.                     }
  193.                     else if (finalPrice >= 12)
  194.                     {
  195.                         finalPrice -= finalPrice * 0.25;
  196.                         if (finalPrice % 2 == 0)
  197.                         {
  198.                             finalPrice -= fisherMen * 0.25;
  199.                         }
  200.                         else
  201.                         {
  202.                             finalPrice -= finalPrice * 0.05;
  203.  
  204.                         }
  205.                     }
  206.  
  207.                     break;
  208.             }
  209.  
  210.             if (budget > finalPrice)
  211.             {
  212.                 Console.WriteLine($"Yes! You have {(budget - finalPrice):f2} leva left.");
  213.             }
  214.             else if (budget < finalPrice)
  215.             {
  216.                 Console.WriteLine($"Not enough money! You need {(finalPrice - budget):f2} leva ");
  217.             }
  218.  
  219.         }
  220.     }
  221. }
  222.  
  223.  
  224.  
  225.  
Advertisement
Add Comment
Please, Sign In to add comment