Advertisement
Guest User

Untitled

a guest
Jan 17th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.34 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ProgrammingFundamentals
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.  
  10.             int people = int.Parse(Console.ReadLine());
  11.             string groupType = Console.ReadLine();
  12.             string dayOfWeek = Console.ReadLine();
  13.             decimal price = 0;
  14.             decimal totalPrice = 0;
  15.  
  16.             if (groupType == "Students")
  17.             {
  18.                 if (dayOfWeek == "Friday")
  19.                 {
  20.                     price = people * 8.45M;
  21.                     if (people >= 30)
  22.                     {
  23.                         totalPrice = price - price * 0.15M;
  24.                     }
  25.                     else
  26.                     {
  27.                         totalPrice = price;
  28.                     }
  29.                 }
  30.                 else if (dayOfWeek == "Saturday")
  31.                 {
  32.                     price = people * 9.80M;
  33.                     if (people >= 30)
  34.                     {
  35.                         totalPrice = price - price * 0.15M;
  36.                     }
  37.                     else
  38.                     {
  39.                         totalPrice = price;
  40.                     }
  41.                 }
  42.                 else if (dayOfWeek == "Sunday")
  43.                 {
  44.                     price = people * 10.46M;
  45.                     if (people >= 30)
  46.                     {
  47.                         totalPrice = price - price * 0.15M;
  48.                     }
  49.                     else
  50.                     {
  51.                         totalPrice = price;
  52.                     }
  53.                 }
  54.             }
  55.             else if (groupType == "Business")
  56.             {
  57.                 if (dayOfWeek == "Friday")
  58.                 {
  59.                     if (people >= 100)
  60.                     {
  61.                         people = people - 10;
  62.                     }
  63.                     price = people * 10.90M;
  64.                     totalPrice = price;
  65.                 }
  66.                 else if (dayOfWeek == "Saturday")
  67.                 {
  68.                     if (people >= 100)
  69.                     {
  70.                         people = people - 10;
  71.                     }
  72.                     price = people * 15.60M;
  73.                     totalPrice = price;
  74.                 }
  75.                 else if (dayOfWeek == "Sunday")
  76.                 {
  77.                     if (people >= 100)
  78.                     {
  79.                         people = people - 10;
  80.                     }
  81.                     price = people * 16;
  82.                     totalPrice = price;
  83.                 }
  84.  
  85.             }
  86.             else if (groupType == "Regular")
  87.             {
  88.                 if (dayOfWeek == "Friday")
  89.                 {
  90.                     price = people * 15;
  91.                 }
  92.                 else if (dayOfWeek == "Saturday")
  93.                 {
  94.                     price = people * 20;
  95.                 }
  96.                 else if (dayOfWeek == "Sunday")
  97.                 {
  98.                     price = people * 22.50M;
  99.                 }
  100.                 if (people >= 10 && people <= 20)
  101.                 {
  102.                     totalPrice = price - price * 0.05M;
  103.                 }
  104.                 else
  105.                 {
  106.                     totalPrice = price;
  107.                 }
  108.             }
  109.             Console.WriteLine($"Total price: {totalPrice:f2}");
  110.  
  111.         }
  112.     }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement