Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2020
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.86 KB | None | 0 0
  1. using System;
  2. using System.Runtime.ConstrainedExecution;
  3.  
  4. namespace FishingBoat
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.            
  11.             double budget = double.Parse(Console.ReadLine());
  12.  
  13.             string season = Console.ReadLine();
  14.  
  15.             double countF = double.Parse(Console.ReadLine());
  16.  
  17.             double boatprice = 0;
  18.  
  19.             double discount = 0;
  20.  
  21.             double boatpriceds = 0;
  22.  
  23.             double adddiscount = 0;
  24.  
  25.             double total = 0;
  26.  
  27.             double finalboatprice = 0;
  28.  
  29.             if (countF % 2 == 0 && season != "Autumn")
  30.  
  31.             {
  32.  
  33.                 adddiscount = boatpriceds * 5 / 100;
  34.             }
  35.  
  36.  
  37.             switch (season)
  38.  
  39.             {
  40.  
  41.                 case "Spring":
  42.  
  43.                     boatprice = 3000;
  44.  
  45.                     if (countF<=6)
  46.  
  47.                     {
  48.                         discount = boatprice * 10 / 100;
  49.  
  50.                         boatpriceds = boatprice - discount;
  51.  
  52.  
  53.                         finalboatprice = boatpriceds - adddiscount;
  54.  
  55.                         total = budget - finalboatprice;
  56.  
  57.                     }
  58.                    
  59.                     else if (countF>=7 && countF<=11)
  60.  
  61.  
  62.                     {
  63.  
  64.  
  65.                         discount = boatprice * 15 / 100;
  66.  
  67.                         boatpriceds = boatprice - discount;
  68.  
  69.  
  70.                         finalboatprice = boatpriceds - adddiscount;
  71.  
  72.                         total = budget - finalboatprice;
  73.                     }
  74.  
  75.                     else if (countF>12)
  76.  
  77.                     {
  78.  
  79.  
  80.                         discount = boatprice * 25 / 100;
  81.  
  82.                         boatpriceds = boatprice - discount;
  83.  
  84.  
  85.                         finalboatprice = boatpriceds - adddiscount;
  86.  
  87.                         total = budget - finalboatprice;
  88.                     }
  89.  
  90.  
  91.                     break;
  92.                 case "Summer":
  93.  
  94.                     boatprice = 4200;
  95.  
  96.                     if (countF <= 6)
  97.  
  98.                     {
  99.                         discount = boatprice * 10 / 100;
  100.  
  101.                         boatpriceds = boatprice - discount;
  102.  
  103.  
  104.                         finalboatprice = boatpriceds - adddiscount;
  105.  
  106.                         total = budget - finalboatprice;
  107.                     }
  108.  
  109.                     else if (countF >= 7 && countF <= 11)
  110.  
  111.  
  112.                     {
  113.  
  114.  
  115.                         discount = boatprice * 15 / 100;
  116.  
  117.                         boatpriceds = boatprice - discount;
  118.  
  119.  
  120.                         finalboatprice = boatpriceds - adddiscount;
  121.  
  122.                         total = budget - finalboatprice;
  123.                     }
  124.  
  125.                     else if (countF > 12)
  126.  
  127.                     {
  128.  
  129.  
  130.                         discount = boatprice * 25 / 100;
  131.  
  132.                         boatpriceds = boatprice - discount;
  133.  
  134.  
  135.                         finalboatprice = boatpriceds - adddiscount;
  136.  
  137.                         total = budget - finalboatprice;
  138.                     }
  139.  
  140.  
  141.                     break;
  142.                 case "Autumn":
  143.  
  144.                     boatprice = 4200;
  145.  
  146.                     if (countF <= 6)
  147.  
  148.                     {
  149.                         discount = boatprice * 10 / 100;
  150.  
  151.                         boatpriceds = boatprice - discount;
  152.  
  153.  
  154.                         finalboatprice = boatpriceds - adddiscount;
  155.  
  156.                         total = budget - finalboatprice;
  157.  
  158.                     }
  159.  
  160.                     else if (countF >= 7 && countF <= 11)
  161.  
  162.  
  163.                     {
  164.  
  165.  
  166.                         discount = boatprice * 15 / 100;
  167.  
  168.                         boatpriceds = boatprice - discount;
  169.  
  170.  
  171.                         finalboatprice = boatpriceds - adddiscount;
  172.  
  173.                         total = budget - finalboatprice;
  174.                     }
  175.  
  176.                     else if (countF > 12)
  177.  
  178.                     {
  179.  
  180.  
  181.                         discount = boatprice * 25 / 100;
  182.  
  183.                         boatpriceds = boatprice - discount;
  184.  
  185.  
  186.                         finalboatprice = boatpriceds - adddiscount;
  187.  
  188.                         total = budget - finalboatprice;
  189.                     }
  190.  
  191.  
  192.                     break;
  193.  
  194.                 case "Winter":
  195.  
  196.                     boatprice = 2600;
  197.  
  198.                     if (countF <= 6)
  199.  
  200.                     {
  201.                         discount = boatprice * 10 / 100;
  202.  
  203.                         boatpriceds = boatprice - discount;
  204.  
  205.  
  206.                         finalboatprice = boatpriceds - adddiscount;
  207.  
  208.                         total = budget - finalboatprice;
  209.  
  210.                     }
  211.  
  212.                     else if (countF >= 7 && countF <= 11)
  213.  
  214.  
  215.                     {
  216.  
  217.  
  218.                         discount = boatprice * 15 / 100;
  219.  
  220.                         boatpriceds = boatprice - discount;
  221.  
  222.  
  223.                         finalboatprice = boatpriceds - adddiscount;
  224.  
  225.                         total = budget - finalboatprice;
  226.                     }
  227.  
  228.                     else if (countF > 12)
  229.  
  230.                     {
  231.  
  232.  
  233.                         discount = boatprice * 25 / 100;
  234.  
  235.                         boatpriceds = boatprice - discount;
  236.  
  237.  
  238.                         finalboatprice = boatpriceds - adddiscount;
  239.  
  240.                         total = budget - finalboatprice;
  241.                     }
  242.  
  243.                     break;
  244.  
  245.                    
  246.             }
  247.  
  248.            
  249.            
  250.  
  251.        
  252.  
  253.  
  254.             if (budget>=finalboatprice)
  255.  
  256.             {
  257.  
  258.  
  259.  
  260.  
  261.  
  262.                 Console.WriteLine($"Yes! You have {total:F2} leva left.");
  263.             }
  264.  
  265.  
  266.             else if (budget<finalboatprice)
  267.  
  268.             {
  269.                 if (total<0)
  270.  
  271.                 { total = -total;
  272.                
  273.                 }
  274.  
  275.                 Console.WriteLine($"Not enough money! You need {total:F2} leva.");
  276.  
  277.             }
  278.         }
  279.     }
  280. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement