Again_89

за Мими exam time

Jan 18th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 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 _07.On_Time_for_the_Exam
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int examTimeHour = int.Parse(Console.ReadLine());
  14. int examTimeMinute = int.Parse(Console.ReadLine());
  15. int arrivalTimeHour = int.Parse(Console.ReadLine());
  16. int arrivalTimeMinute = int.Parse(Console.ReadLine());
  17.  
  18. int examTimeOnlyMinutes = (examTimeHour * 60) + examTimeMinute;
  19. int arrivalTimeOnlyMinutes = (arrivalTimeHour * 60) + arrivalTimeMinute;
  20.  
  21. if ((examTimeOnlyMinutes > arrivalTimeOnlyMinutes) && (examTimeOnlyMinutes - arrivalTimeOnlyMinutes > 30))
  22. {
  23. int tooEarlyMinutes = examTimeOnlyMinutes - arrivalTimeOnlyMinutes;
  24. int tooEarlyHours = 0;
  25. int tooEarlyMinutes1 = 0;
  26. if (tooEarlyMinutes > 59)
  27. {
  28. tooEarlyHours = tooEarlyMinutes / 60;
  29. tooEarlyMinutes1 = tooEarlyMinutes % 60;
  30. if (tooEarlyMinutes1 <= 9)
  31. {
  32. Console.WriteLine("Early");
  33. Console.WriteLine($"{tooEarlyHours}:0{tooEarlyMinutes1} hours before the start");
  34. }
  35. else
  36. {
  37. Console.WriteLine("Early");
  38. Console.WriteLine($"{tooEarlyHours}:{tooEarlyMinutes1} hours before the start");
  39. }
  40. }
  41. else
  42. {
  43. Console.WriteLine("Early");
  44. Console.WriteLine($"{tooEarlyMinutes} minutes before the start");
  45. }
  46. }
  47.  
  48. else if ((examTimeOnlyMinutes > arrivalTimeOnlyMinutes) && (examTimeOnlyMinutes - arrivalTimeOnlyMinutes <= 30))
  49. {
  50. Console.WriteLine("On time");
  51. Console.WriteLine($"{examTimeOnlyMinutes - arrivalTimeOnlyMinutes} minutes before the start");
  52. }
  53. else if (examTimeOnlyMinutes - arrivalTimeOnlyMinutes == 0)
  54. {
  55. Console.WriteLine("On time");
  56. }
  57. else if (examTimeOnlyMinutes < arrivalTimeOnlyMinutes && (examTimeOnlyMinutes - arrivalTimeOnlyMinutes <= 30))
  58. {
  59. int tooLateMinutes = arrivalTimeOnlyMinutes - examTimeOnlyMinutes;
  60. int tooLateHours = 0;
  61. int tooLateMinutes1 = 0;
  62. if (tooLateMinutes > 59)
  63. {
  64. tooLateHours = tooLateMinutes / 60;
  65. tooLateMinutes1 = tooLateMinutes % 60;
  66. if (tooLateMinutes1 <= 9)
  67. {
  68. Console.WriteLine("Late");
  69. Console.WriteLine($"{tooLateHours}:0{tooLateMinutes1} hours after the start");
  70. }
  71. else
  72. {
  73. Console.WriteLine("Late");
  74. Console.WriteLine($"{tooLateHours}:{tooLateMinutes1} hours after the start");
  75. }
  76. }
  77. else
  78. {
  79. Console.WriteLine("Late");
  80. Console.WriteLine($"{tooLateMinutes} minutes after the start");
  81. }
  82. }
  83. }
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment