Advertisement
nevenailievaa

03.Vacation

Jan 15th, 2023
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.82 KB | None | 0 0
  1. //INPUT
  2. int numberPeopleOnVacation = int.Parse(Console.ReadLine());
  3. string typeGroup = Console.ReadLine();
  4. string dayOfTheWeek = Console.ReadLine();
  5.  
  6. //CHANGEABLE
  7. double oneTicketPrice = 0;
  8. double ticketsSum = 0;
  9.  
  10. //ACTION
  11. //Friday
  12. if (dayOfTheWeek == "Friday")
  13. {
  14.     if (typeGroup == "Students")
  15.     {
  16.         oneTicketPrice = 8.45;
  17.         ticketsSum = oneTicketPrice * numberPeopleOnVacation;
  18.  
  19.         if (numberPeopleOnVacation >= 30)
  20.         {
  21.             ticketsSum -= (ticketsSum * 0.15);
  22.         }
  23.     }
  24.     else if (typeGroup == "Business")
  25.     {
  26.         oneTicketPrice = 10.90;
  27.         ticketsSum = oneTicketPrice * numberPeopleOnVacation;
  28.  
  29.         if (numberPeopleOnVacation >= 100)
  30.         {
  31.             ticketsSum -= (oneTicketPrice * 10);
  32.         }
  33.     }
  34.     else if (typeGroup == "Regular")
  35.     {
  36.         oneTicketPrice = 15.00;
  37.         ticketsSum = oneTicketPrice * numberPeopleOnVacation;
  38.  
  39.         if (numberPeopleOnVacation >= 10 && numberPeopleOnVacation <= 20)
  40.         {
  41.             ticketsSum -= (ticketsSum * 0.05);
  42.         }
  43.     }
  44. }
  45. //Saturday
  46. if (dayOfTheWeek == "Saturday")
  47. {
  48.     if (typeGroup == "Students")
  49.     {
  50.         oneTicketPrice = 9.80;
  51.         ticketsSum = oneTicketPrice * numberPeopleOnVacation;
  52.  
  53.         if (numberPeopleOnVacation >= 30)
  54.         {
  55.             ticketsSum -= (ticketsSum * 0.15);
  56.         }
  57.     }
  58.     else if (typeGroup == "Business")
  59.     {
  60.         oneTicketPrice = 15.60;
  61.         ticketsSum = oneTicketPrice * numberPeopleOnVacation;
  62.  
  63.         if (numberPeopleOnVacation >= 100)
  64.         {
  65.             ticketsSum -= (oneTicketPrice * 10);
  66.         }
  67.     }
  68.     else if (typeGroup == "Regular")
  69.     {
  70.         oneTicketPrice = 20.00;
  71.         ticketsSum = oneTicketPrice * numberPeopleOnVacation;
  72.  
  73.         if (numberPeopleOnVacation >= 10 && numberPeopleOnVacation <= 20)
  74.         {
  75.             ticketsSum -= (ticketsSum * 0.05);
  76.         }
  77.     }
  78. }
  79. //Sunday
  80. if (dayOfTheWeek == "Sunday")
  81. {
  82.     if (typeGroup == "Students")
  83.     {
  84.         oneTicketPrice = 10.46;
  85.         ticketsSum = oneTicketPrice * numberPeopleOnVacation;
  86.  
  87.         if (numberPeopleOnVacation >= 30)
  88.         {
  89.             ticketsSum -= (ticketsSum * 0.15);
  90.         }
  91.     }
  92.     else if (typeGroup == "Business")
  93.     {
  94.         oneTicketPrice = 16.00;
  95.         ticketsSum = oneTicketPrice * numberPeopleOnVacation;
  96.  
  97.         if (numberPeopleOnVacation >= 100)
  98.         {
  99.             ticketsSum -= (oneTicketPrice * 10);
  100.         }
  101.     }
  102.     else if (typeGroup == "Regular")
  103.     {
  104.         oneTicketPrice = 22.50;
  105.         ticketsSum = oneTicketPrice * numberPeopleOnVacation;
  106.  
  107.         if (numberPeopleOnVacation >= 10 && numberPeopleOnVacation <= 20)
  108.         {
  109.             ticketsSum -= (ticketsSum * 0.05);
  110.         }
  111.     }
  112. }
  113.  
  114. //OUTPUT
  115. Console.WriteLine($"Total price: {ticketsSum:f2}");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement