kzborisov

MatchTickets

Sep 22nd, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 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 Match_Tickets
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. decimal budget = decimal.Parse(Console.ReadLine());
  14. string ticketType = Console.ReadLine();
  15. int peopleCount = int.Parse(Console.ReadLine());
  16.  
  17. decimal transportCharges = 0.00M;
  18. decimal moneyForTickets = 0.00M;
  19. decimal difference = 0.00M;
  20.  
  21. if (peopleCount <= 4)
  22. {
  23. transportCharges = 0.75M * budget;
  24. }
  25. else if (peopleCount <= 9)
  26. {
  27. transportCharges = 0.60M * budget;
  28. }
  29. else if (peopleCount <= 24)
  30. {
  31. transportCharges = 0.50M * budget;
  32. }
  33. else if (peopleCount <= 49)
  34. {
  35. transportCharges = 0.40M * budget;
  36. }
  37. else if (peopleCount >= 50)
  38. {
  39. transportCharges = 0.25M * budget;
  40. }
  41.  
  42. switch (ticketType)
  43. {
  44. case "Normal":
  45. moneyForTickets = peopleCount * 249.99M;
  46. break;
  47. case "VIP":
  48. moneyForTickets = peopleCount * 499.99M;
  49. break;
  50. default:
  51. moneyForTickets = peopleCount * 249.99M;
  52. break;
  53. }
  54. difference = budget - moneyForTickets - transportCharges;
  55. string result = string.Format("Yes! You have {0} leva left.", decimal.Round(difference,2));
  56.  
  57. if (difference < 0)
  58. {
  59. result = string.Format("Not enough money! You need {0:F2} leva.",
  60. Math.Abs(decimal.Round(difference, 2)));
  61. }
  62. Console.WriteLine(result);
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment