Advertisement
dragonbs

VacationFundamentals

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