Guest User

Untitled

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