Advertisement
Guest User

Untitled

a guest
Oct 27th, 2019
863
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.04 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 World_Snooker_Championship
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string stage = Console.ReadLine();
  14.             string type = Console.ReadLine();
  15.             int numTickets = int.Parse(Console.ReadLine());
  16.             char picture = char.Parse(Console.ReadLine());
  17.             double unitPrice = 0.0;
  18.  
  19.             if (stage == "Quarter final")
  20.             {
  21.                 switch (type)
  22.                 {
  23.                     case "Standard": unitPrice = 55.50; break;
  24.                     case "Premium": unitPrice = 105.20; break;
  25.                     case "VIP": unitPrice = 118.90; break;
  26.                 }
  27.             }
  28.             else if (stage == "Semi final")
  29.             {
  30.                 switch (type)
  31.                 {
  32.                     case "Standard": unitPrice = 75.88; break;
  33.                     case "Premium": unitPrice = 125.22; break;
  34.                     case "VIP": unitPrice = 300.40; break;
  35.                 }
  36.             }
  37.             else if (stage == "Final")
  38.             {
  39.                 switch (type)
  40.                 {
  41.                     case "Standard": unitPrice = 110.10; break;
  42.                     case "Premium": unitPrice = 160.66; break;
  43.                     case "VIP": unitPrice = 400.0; break;
  44.                 }
  45.             }
  46.  
  47.             double price = numTickets * unitPrice;
  48.  
  49.             if (price > 4000)
  50.             {
  51.                 price *= 0.75;
  52.                 Console.WriteLine($"{price:f2}");
  53.                 return;
  54.             }
  55.             else if (price > 2500)
  56.             {
  57.                 price *= 0.90;
  58.             }
  59.  
  60.             if (picture == 'Y')
  61.             {
  62.                 price += (numTickets * 40.0);
  63.                 Console.WriteLine($"{price:f2}");
  64.             }
  65.             else
  66.             {
  67.                 Console.WriteLine($"{price:f2}");
  68.             }
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement