Radost09

Vacation

Jan 15th, 2022
921
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.81 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Vacation
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int countOfPeople = int.Parse(Console.ReadLine());
  10.             string typeOfGroup = Console.ReadLine();
  11.             string dayOfWeek = Console.ReadLine();
  12.             double price = 0;
  13.  
  14.             if(dayOfWeek == "Friday")
  15.             {
  16.                 switch(typeOfGroup)
  17.                 {
  18.                     case "Students": price = 8.45; break;
  19.                     case "Business" : price = 10.90; break;
  20.                     case "Regular": price = 15.00; break;
  21.                 }
  22.             }
  23.             if(dayOfWeek == "Saturday")
  24.             {
  25.                 switch(typeOfGroup)
  26.                 {
  27.                     case "Students": price = 9.80; break;
  28.                     case "Business": price = 15.60; break;
  29.                     case "Regular": price = 20.00; break;
  30.                 }
  31.             }
  32.             if(dayOfWeek == "Sunday")
  33.             {
  34.                 switch(typeOfGroup)
  35.                 {
  36.                     case "Students": price = 10.46; break;
  37.                     case "Business": price = 16.00; break;
  38.                     case "Regular": price = 22.50; break;
  39.                 }
  40.             }
  41.             if(typeOfGroup == "Students" && countOfPeople >= 30)
  42.             {
  43.                 price = price - (price * 0.15);
  44.             }
  45.             else if(typeOfGroup == "Business" && countOfPeople >= 100)
  46.             {
  47.                 countOfPeople -= 10;
  48.             }
  49.             else if(typeOfGroup == "Regular" && countOfPeople >= 10 && countOfPeople <= 20)
  50.             {
  51.                 price = price - (price * 0.05);
  52.             }
  53.             Console.WriteLine($"Total price: {price*countOfPeople:F2}");
  54.         }
  55.     }
  56. }
  57.  
Advertisement
Add Comment
Please, Sign In to add comment