Advertisement
simonradev

sad

May 15th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.51 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 = ticketCategory == "Normal" ? 249.99 : 499.99;
  32.  
  33.             double moneyLeftAfterTransport = budget - (budget * percentageForTransport);
  34.             double moneyNeededForTickets = peopleCount * ticketPrice;
  35.  
  36.             double moneyLeft = Math.Abs(moneyLeftAfterTransport - moneyNeededForTickets);
  37.            
  38.              Console.WriteLine(moneyLeftAfterTransport >= moneyNeededForTickets ?
  39.                                   $"Yes! You have {moneyLeft:f2} leva left." :
  40.                                   $"Not enough money! You need {moneyLeft:f2} leva.");
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement