Advertisement
Guest User

Untitled

a guest
Sep 30th, 2018
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.89 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _06
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double budget = double.Parse(Console.ReadLine());
  14.             string season = Console.ReadLine();
  15.             int fishers = int.Parse(Console.ReadLine());
  16.  
  17.             double boatPrice = 0.0;
  18.             double discount = 0.0;
  19.             double totalPrice = 0.0;
  20.  
  21.             switch (season)
  22.             {
  23.                 case "Spring":
  24.                     boatPrice = 3000;
  25.                     break;
  26.                 case "Summer":
  27.                 case "Autumn":
  28.                     boatPrice = 4200;
  29.                     break;
  30.                 case "Winter":
  31.                     boatPrice = 2600;
  32.                     break;
  33.  
  34.                 default:
  35.                     break;
  36.             }
  37.  
  38.             if (fishers <= 6)
  39.             {
  40.                 discount = boatPrice * 10 / 100;
  41.             }
  42.             else if (fishers >= 7 && fishers <= 11)
  43.             {
  44.                 discount = boatPrice * 15 / 100;
  45.             }
  46.             else if (fishers >= 12)
  47.             {
  48.                 discount = boatPrice * 25 / 100;
  49.             }
  50.  
  51.             if (fishers % 2 == 0 && season != "Autumn")
  52.             {
  53.                 discount = discount + boatPrice * 5 / 100;
  54.             }
  55.  
  56.             totalPrice = boatPrice - discount;
  57.  
  58.             if (budget >= totalPrice)
  59.             {
  60.                 double moneyLeft = budget - totalPrice;
  61.                 Console.WriteLine("Yes! You have {0:F2} leva left.", moneyLeft);
  62.             }
  63.             else
  64.             {
  65.                 double moneyNeeded = totalPrice - budget;
  66.                 Console.WriteLine("Not enough money! You need {0:F2} leva.", moneyNeeded);
  67.             }
  68.  
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement