Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.19 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. class Vacation
  5. {
  6.     static void Main()
  7.     {
  8.         int groupOfPeople = int.Parse(Console.ReadLine());
  9.         string groupType = Console.ReadLine().ToLower();
  10.         string dayOfWeek = Console.ReadLine().ToLower();
  11.  
  12.         double price = 0.0;
  13.  
  14.         switch (groupType)
  15.         {
  16.             case "students":
  17.                 if (dayOfWeek.Equals("friday"))
  18.                 {
  19.                     price = 8.45 * groupOfPeople;
  20.                 }
  21.                 else if (dayOfWeek.Equals("saturday"))
  22.                 {
  23.                     price = 9.80 * groupOfPeople;
  24.                 }
  25.                 else if (dayOfWeek.Equals("sunday"))
  26.                 {
  27.                     price = 10.46 * groupOfPeople;
  28.                 }
  29.  
  30.                 if (groupOfPeople >= 30)
  31.                 {
  32.                     price -= (price * 0.15);
  33.                 }
  34.                 break;
  35.  
  36.             case "business":
  37.                 if (groupOfPeople >= 100)
  38.                 {
  39.                     groupOfPeople -= 10;
  40.                 }
  41.  
  42.                 if (dayOfWeek.Equals("friday"))
  43.                 {
  44.                     price = 10.90 * groupOfPeople;
  45.                 }
  46.                 else if (dayOfWeek.Equals("saturday"))
  47.                 {
  48.                     price = 15.60 * groupOfPeople;
  49.                 }
  50.                 else if (dayOfWeek.Equals("sunday"))
  51.                 {
  52.                     price = 16 * groupOfPeople;
  53.                 }
  54.                 break;
  55.  
  56.             case "regular":
  57.                 if (dayOfWeek.Equals("friday"))
  58.                 {
  59.                     price = 15 * groupOfPeople;
  60.                 }
  61.                 else if (dayOfWeek.Equals("saturday"))
  62.                 {
  63.                     price = 20 * groupOfPeople;
  64.                 }
  65.                 else if (dayOfWeek.Equals("sunday"))
  66.                 {
  67.                     price = 22.50 * groupOfPeople;
  68.                 }
  69.  
  70.                 if (groupOfPeople >= 10 && groupOfPeople <= 20)
  71.                 {
  72.                     price -= (price * 0.05);
  73.                 }
  74.                 break;
  75.         }
  76.  
  77.         Console.WriteLine($"Total price: {price:f2}");
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement