Advertisement
Guest User

Vacation

a guest
Jan 22nd, 2020
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.82 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Vacation
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int number = int.Parse(Console.ReadLine());
  10.             string typeOfGroup = Console.ReadLine();
  11.             string dayOfWeek = Console.ReadLine();
  12.             decimal pricePerson = 0;
  13.             decimal totalPrice = 0;
  14.  
  15.  
  16.             if (typeOfGroup == "Students")
  17.             {
  18.                 if (dayOfWeek == "Friday")
  19.                     pricePerson = 8.45M;
  20.                 if (dayOfWeek == "Saturday")
  21.                     pricePerson = 9.80M;
  22.                 if (dayOfWeek == "Sunday")
  23.                     pricePerson = 10.46M;
  24.             }
  25.             else if (typeOfGroup == "Business")
  26.             {
  27.                 if (dayOfWeek == "Friday")
  28.                     pricePerson = 10.90M;
  29.                 if (dayOfWeek == "Saturday")
  30.                     pricePerson = 15.60M;
  31.                 if (dayOfWeek == "Sunday")
  32.                     pricePerson = 16M;
  33.             }
  34.             else if (typeOfGroup == "Regular")
  35.             {
  36.                 if (dayOfWeek == "Friday")
  37.                     pricePerson = 15M;
  38.                 if (dayOfWeek == "Saturday")
  39.                     pricePerson = 20M;
  40.                 if (dayOfWeek == "Sunday")
  41.                     pricePerson = 22.50M;
  42.             }
  43.  
  44.             if (typeOfGroup == "Business" && number >= 100)
  45.             {
  46.                 number -= 10;          
  47.             }
  48.             totalPrice = pricePerson * number;
  49.  
  50.             if (typeOfGroup == "Students" && number >= 30)
  51.                 totalPrice *= 0.85M;
  52.  
  53.             if (typeOfGroup == "Regular" && (number >= 10 && number <= 20))
  54.                 totalPrice *= 0.95M;
  55.  
  56.             Console.WriteLine($"Total price: {totalPrice:f2}");
  57.  
  58.  
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement