Advertisement
simonradev

MatchTickets

May 15th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _16.Number0100ToText
  4. {
  5.     class Number0100ToText
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double budget = double.Parse(Console.ReadLine());
  10.             string ticketCategory = Console.ReadLine();
  11.             int peopleCount = int.Parse(Console.ReadLine());
  12.            
  13.             double percentageForTransport = 0.75;
  14.             if (peopleCount >= 5 && peopleCount <= 9)
  15.             {
  16.                 percentageForTransport = 0.6;
  17.             }
  18.             else if (peopleCount >= 10 && peopleCount <= 24)
  19.             {
  20.                 percentageForTransport = 0.5;
  21.             }
  22.             else if (peopleCount >= 25 && peopleCount <= 49)
  23.             {
  24.                 percentageForTransport = 0.4;
  25.             }
  26.             else if (peopleCount >= 50)
  27.             {
  28.                 percentageForTransport = 0.25;
  29.             }
  30.            
  31.             double ticketPrice = 499.99;
  32.             if (ticketCategory == "Normal")
  33.             {
  34.                 ticketPrice = 249.99;
  35.             }
  36.  
  37.             double moneyLeftAfterTransport = budget - (budget * percentageForTransport);
  38.             double moneyNeededForTickets = peopleCount * ticketPrice;
  39.  
  40.             double moneyLeft = Math.Abs(moneyLeftAfterTransport - moneyNeededForTickets);
  41.  
  42.             if (moneyLeftAfterTransport >= moneyNeededForTickets)
  43.             {
  44.                 Console.WriteLine($"Yes! You have {moneyLeft:f2} leva left.");
  45.             }
  46.             else
  47.             {
  48.                 Console.WriteLine($"Not enough money! You need {moneyLeft:f2} leva.");
  49.             }
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement