Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.36 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 personsCount = int.Parse(Console.ReadLine());
  10.             string groupType = Console.ReadLine();
  11.             string day = Console.ReadLine();
  12.  
  13.             double pricePerPerson = 0;
  14.  
  15.             if (groupType == "Students")
  16.             {
  17.                 if (day == "Friday")
  18.                 {
  19.                     pricePerPerson = 8.45;
  20.                 }
  21.                 else if (day == "Saturday")
  22.                 {
  23.                     pricePerPerson = 9.80;
  24.                 }
  25.                 else if (day == "Sunday")
  26.                 {
  27.                     pricePerPerson = 10.46;
  28.                 }
  29.             }
  30.             if (groupType == "Business")
  31.             {
  32.                 if (day == "Friday")
  33.                 {
  34.                     pricePerPerson = 10.90;
  35.                 }
  36.                 else if (day == "Saturday")
  37.                 {
  38.                     pricePerPerson = 15.60;
  39.                 }
  40.                 else if (day == "Sunday")
  41.                 {
  42.                     pricePerPerson = 16;
  43.                 }
  44.             }
  45.             if (groupType == "Regular")
  46.             {
  47.                 if (day == "Friday")
  48.                 {
  49.                     pricePerPerson = 15;
  50.                 }
  51.                 else if (day == "Saturday")
  52.                 {
  53.                     pricePerPerson = 20;
  54.                 }
  55.                 else if (day == "Sunday")
  56.                 {
  57.                     pricePerPerson = 22.50;
  58.                 }
  59.             }
  60.             double totalPrice = pricePerPerson * personsCount;
  61.  
  62.  
  63.             if (groupType == "Students" && personsCount >= 30)
  64.             {
  65.                 totalPrice = totalPrice * 0.85;
  66.                 Console.WriteLine($"Total price: {totalPrice:F2}");
  67.  
  68.             }
  69.             if (groupType == "Business" && personsCount >= 100)
  70.             {
  71.                 totalPrice = (totalPrice - (pricePerPerson * 10));
  72.                 Console.WriteLine($"Total price: {totalPrice:F2}");
  73.  
  74.             }
  75.             if (groupType == "Regular" && personsCount >= 10 && personsCount <= 20)
  76.             {
  77.                 totalPrice = totalPrice * 0.95;
  78.                 Console.WriteLine($"Total price: {totalPrice:F2}");
  79.             }
  80.         }
  81.     }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement