Advertisement
Guest User

03. Computer Room

a guest
May 21st, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ComputerRoom
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. string mount = Console.ReadLine();
  15. int hoursPlayed = int.Parse(Console.ReadLine());
  16. int peopleNumber = int.Parse(Console.ReadLine());
  17. string dayTime = Console.ReadLine();
  18.  
  19. double priceForHour = 0;
  20.  
  21. if (mount == "march" || mount == "april"|| mount == "may")
  22. {
  23.  
  24. if (dayTime=="day")
  25. {
  26. priceForHour = 10.50; ;
  27. }
  28. else if (dayTime == "night")
  29. {
  30. priceForHour = 8.40;
  31. }
  32.  
  33.  
  34. }
  35. if (mount == "june" || mount == "july" || mount == "august")
  36. {
  37. if (dayTime == "day")
  38. {
  39. priceForHour = 12.60; ;
  40. }
  41. else if (dayTime == "night")
  42. {
  43. priceForHour = 10.20;
  44. }
  45. }
  46.  
  47. if (peopleNumber >= 4)
  48. {
  49. priceForHour = priceForHour - 0.10 * priceForHour;
  50.  
  51. }
  52. if (hoursPlayed >= 5)
  53. {
  54. priceForHour = priceForHour - 0.50 * priceForHour;
  55. }
  56.  
  57.  
  58. double totalCost = priceForHour * peopleNumber;
  59. Console.WriteLine($"Price per person for one hour: {priceForHour:F2}");
  60. Console.WriteLine($"Total cost of the visit: {totalCost*peopleNumber:F2}");
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement