Advertisement
TeodorN

Vacation

May 15th, 2019
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.92 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Practice___Vacation
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.              // Input
  10.             double numberOfPersons = int.Parse(Console.ReadLine());
  11.             string typeOfGuests = Console.ReadLine();
  12.             string dayOfTheWeek = Console.ReadLine();
  13.              // Strings for type of guests
  14.             string students = "Students";
  15.             string Business = "Business";
  16.             string Regular = "Regular";
  17.              // Strings fot type of the day
  18.             string friday = "Friday";
  19.             string saturday = "Saturday";
  20.             string sunday = "Sunday";
  21.              //Main variables
  22.             double price = 0.0;
  23.             double totalPrice = 0;
  24.  
  25.             //Cheking for correct types peoples and days
  26.             //Calculatin the total amouth for the group
  27.             if (typeOfGuests == students)
  28.             {
  29.                 if (dayOfTheWeek == friday)
  30.                 {
  31.                     //Cheking do the groupe have discount ot not
  32.                     if (numberOfPersons >= 30 || typeOfGuests == students)
  33.                     {
  34.                         price = 8.45;
  35.                         totalPrice = price * numberOfPersons;
  36.                         double discount = totalPrice * 0.85;
  37.                         Console.WriteLine($"Total price: {discount:F2}");
  38.                     }
  39.                     else
  40.                     {
  41.                         price = 8.45;
  42.                         totalPrice = price * numberOfPersons;
  43.                         Console.WriteLine($"Total price: {totalPrice:F2}");
  44.                     }
  45.  
  46.                 }
  47.                 else if (dayOfTheWeek == saturday)
  48.                 {
  49.                     //Cheking do the groupe have discount ot not
  50.                     if (numberOfPersons >= 30 || typeOfGuests == students)
  51.                     {
  52.                         price = 9.80;
  53.                         totalPrice = price * numberOfPersons;
  54.                         double discount = totalPrice * 0.85;
  55.                         Console.WriteLine($"Total price: {discount:F2}");
  56.                     }
  57.                     else
  58.                     {
  59.                         price = 9.80;
  60.                         totalPrice = price * numberOfPersons;
  61.                         Console.WriteLine($"Total price: {totalPrice:F2}");
  62.                     }
  63.  
  64.                 }
  65.                 else if (dayOfTheWeek == sunday)
  66.                 {
  67.                     //Cheking do the groupe have discount ot not
  68.                     if (numberOfPersons >= 30 || typeOfGuests == students)
  69.                     {
  70.                         price = 10.46;
  71.                         totalPrice = price * numberOfPersons;
  72.                         double discount = totalPrice * 0.85;
  73.                         Console.WriteLine($"Total price: {discount:F2}");
  74.                     }
  75.                     else
  76.                     {
  77.                         price = 10.46;
  78.                         totalPrice = price * numberOfPersons;
  79.                         Console.WriteLine($"Total price: {totalPrice:F2}");
  80.                     }
  81.  
  82.                 }
  83.             }
  84.             else if (typeOfGuests == Business)
  85.             {
  86.                 if (dayOfTheWeek == friday)
  87.                 {
  88.                     //Cheking do the groupe have discount ot not
  89.                     if (numberOfPersons >= 100 || typeOfGuests == Business)
  90.                     {
  91.                         price = 10.90;
  92.                         double discount = numberOfPersons - 10;
  93.                         totalPrice = discount * price;
  94.                         Console.WriteLine($"Total price: {totalPrice:F2}");
  95.                     }
  96.                     else
  97.                     {
  98.                         price = 10.90;
  99.                         totalPrice = price * numberOfPersons;
  100.                         Console.WriteLine($"Total price: {totalPrice:F2}");
  101.                     }
  102.  
  103.                 }
  104.                 else if (dayOfTheWeek == saturday)
  105.                 {
  106.                     //Cheking do the groupe have discount ot not
  107.                     if (numberOfPersons >= 100 || typeOfGuests == Business)
  108.                     {
  109.                         price = 15.60;
  110.                         double discount = numberOfPersons - 10;
  111.                         totalPrice = discount * price;
  112.                         Console.WriteLine($"Total price: {totalPrice:F2}");
  113.                     }
  114.                     else
  115.                     {
  116.                         price = 15.60;
  117.                         totalPrice = price * numberOfPersons;
  118.                         Console.WriteLine($"Total price: {totalPrice:F2}");
  119.                     }
  120.  
  121.                 }
  122.                 else if (dayOfTheWeek == sunday)
  123.                 {
  124.                     //Cheking do the groupe have discount ot not
  125.                     if (numberOfPersons >= 100 || typeOfGuests == Business)
  126.                     {
  127.                         price = 16;
  128.                         double discount = numberOfPersons - 10;
  129.                         totalPrice = discount * price;
  130.                         Console.WriteLine($"Total price: {totalPrice:F2}");
  131.                     }
  132.                     else
  133.                     {
  134.                         price = 16;
  135.                         totalPrice = price * numberOfPersons;
  136.                         Console.WriteLine($"Total price: {totalPrice:F2}");
  137.                     }
  138.  
  139.                 }
  140.             }
  141.             else if (typeOfGuests == Regular)
  142.             {
  143.                 if (dayOfTheWeek == friday)
  144.                 {
  145.                     //Cheking do the groupe have discount ot not.
  146.                     if (numberOfPersons >= 10 && typeOfGuests == Regular && numberOfPersons <= 20)
  147.                     {
  148.                         price = 15;
  149.                         totalPrice = price * numberOfPersons;
  150.                         double discount = totalPrice * 0.95;
  151.                         Console.WriteLine($"Total price: {discount:F2}");
  152.  
  153.                     }
  154.                     else
  155.                     {
  156.                         price = 15;
  157.                         totalPrice = price * numberOfPersons;
  158.                         Console.WriteLine($"Total price: {totalPrice:F2}");
  159.                     }
  160.  
  161.                 }
  162.                 else if (dayOfTheWeek == saturday)
  163.                 {
  164.                     //Cheking do the groupe have discount ot not
  165.                     if (numberOfPersons <= 20 && typeOfGuests == Regular && numberOfPersons >= 10)
  166.                     {
  167.                         price = 20;
  168.                         totalPrice = price * numberOfPersons;
  169.                         double discount = totalPrice * 0.95;
  170.                         Console.WriteLine($"Total price: {discount:F2}");
  171.                     }
  172.                     else
  173.                     {
  174.                         price = 20;
  175.                         totalPrice = price * numberOfPersons;
  176.                         Console.WriteLine($"Total price: {totalPrice:F2}");
  177.                     }
  178.  
  179.                 }
  180.                 else if (dayOfTheWeek == sunday)
  181.                 {
  182.                      //Cheking do the groupe have discount ot not
  183.                     if (numberOfPersons >= 10 && numberOfPersons <= 20 && typeOfGuests == Regular)
  184.                     {
  185.                         price = 22.50;
  186.                         totalPrice = price * numberOfPersons;
  187.                         double discount = totalPrice * 0.95;
  188.                         Console.WriteLine($"Total price: {discount:F2}");
  189.                     }
  190.                     else
  191.                     {
  192.                         price = 22.50;
  193.                         totalPrice = price * numberOfPersons;
  194.                         Console.WriteLine($"Total price: {totalPrice:F2}");
  195.  
  196.                     }
  197.  
  198.                 }
  199.             }
  200.  
  201.         }
  202.     }
  203. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement