Guest User

Untitled

a guest
Apr 4th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace ConsoleApp13
  5. {
  6. public class Program
  7. {
  8. static void Main()
  9. {
  10.  
  11.  
  12. decimal numberOfPeople = int.Parse(Console.ReadLine());
  13. string typeOfGroup = Console.ReadLine();
  14. string dayOfTheWeek = Console.ReadLine();
  15.  
  16. decimal pricePerNight = 0;
  17.  
  18. // Calculating the price per night dependind on the day of the week and the type of the group
  19.  
  20. if (typeOfGroup == "Students" && dayOfTheWeek == "Friday")
  21. pricePerNight = 8.45m;
  22.  
  23. if (typeOfGroup == "Business" && dayOfTheWeek == "Friday")
  24. pricePerNight = 10.90m;
  25.  
  26. if (typeOfGroup == "Regular" && dayOfTheWeek == "Friday")
  27. pricePerNight = 15.00m;
  28.  
  29. if (typeOfGroup == "Students" && dayOfTheWeek == "Saturday")
  30. pricePerNight = 9.80m;
  31.  
  32. if (typeOfGroup == "Business" && dayOfTheWeek == "Saturday")
  33. pricePerNight = 15.60m;
  34.  
  35. if (typeOfGroup == "Regular" && dayOfTheWeek == "Saturday")
  36. pricePerNight = 20.00m;
  37.  
  38. if (typeOfGroup == "Students" && dayOfTheWeek == "Sunday")
  39. pricePerNight = 10.46m;
  40.  
  41. if (typeOfGroup == "Business" && dayOfTheWeek == "Sunday")
  42. pricePerNight = 16.00m;
  43.  
  44. if (typeOfGroup == "Regular" && dayOfTheWeek == "Sunday")
  45. pricePerNight = 22.50m;
  46.  
  47. decimal totalPrice = pricePerNight * numberOfPeople;
  48.  
  49. // Discounts
  50.  
  51. decimal discount = 0;
  52.  
  53. if (typeOfGroup == "Students" && numberOfPeople >= 30)
  54. {
  55. discount = (totalPrice / 100) * 15;
  56. totalPrice -= discount;
  57. }
  58. if (typeOfGroup == "Business" && numberOfPeople >= 100)
  59. {
  60. totalPrice = totalPrice - pricePerNight * 10;
  61. }
  62.  
  63. if (typeOfGroup == "Regular" && numberOfPeople >= 10 && numberOfPeople < 21)
  64. {
  65. discount = (totalPrice / 100) * 5;
  66. totalPrice -= discount;
  67. }
  68.  
  69. Console.WriteLine($"Total price: {Math.Round(totalPrice, 2)}");
  70.  
  71.  
  72. }
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment