anizko

03. Vacation

May 19th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.60 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 _3.Vacation
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int CountPeople = int.Parse(Console.ReadLine());
  14.             string KindGroup = Console.ReadLine();
  15.             string Day = Console.ReadLine();
  16.  
  17.             double price = 0;
  18.             double TotalSum = 0;
  19.  
  20.             switch (Day)
  21.             {
  22.                 case "Friday":
  23.                     switch (KindGroup)
  24.                     {
  25.                         case "Students":
  26.                             price = 8.45;
  27.                             break;
  28.                         case "Business":
  29.                             price = 10.90;
  30.                             break;
  31.                         case "Regular":
  32.                             price = 15.00;
  33.                             break;
  34.                     }
  35.                     break;
  36.                 case "Saturday":
  37.                     switch (KindGroup)
  38.                     {
  39.                         case "Students":
  40.                             price = 9.80;
  41.                             break;
  42.                         case "Business":
  43.                             price = 15.60;
  44.                             break;
  45.                         case "Regular":
  46.                             price = 20.00;
  47.                             break;
  48.                     }
  49.                     break;
  50.                 case "Sunday":
  51.                     switch (KindGroup)
  52.                     {
  53.                         case "Students":
  54.                             price = 10.46;
  55.                             break;
  56.                         case "Business":
  57.                             price = 16.00;
  58.                             break;
  59.                         case "Regular":
  60.                             price = 22.50;
  61.                             break;
  62.                     }
  63.                     break;
  64.             }
  65.  
  66.             TotalSum = price * CountPeople;
  67.  
  68.             if (KindGroup == "Students" && CountPeople >= 30)
  69.             {
  70.                 TotalSum = TotalSum - (TotalSum * 15 / 100);
  71.             }
  72.             if (KindGroup == "Business" && CountPeople >= 100)
  73.             {
  74.                 TotalSum = TotalSum - (price * 10);
  75.             }
  76.             if (KindGroup == "Regular" && CountPeople >= 10 && CountPeople <= 20)
  77.             {
  78.                 TotalSum = TotalSum - (TotalSum * 5 / 100);
  79.             }
  80.  
  81.             Console.WriteLine($"Total price: {TotalSum:f2}");
  82.  
  83.         }
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment