Advertisement
Qrist

Vacation

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