Advertisement
sivancheva

OnTImeForThe Exam

May 3rd, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. var hourExam = int.Parse(Console.ReadLine());
  8. var minuteExam = int.Parse(Console.ReadLine());
  9. var hourArrive = int.Parse(Console.ReadLine());
  10. var minuteArrive = int.Parse(Console.ReadLine());
  11.  
  12. var hourExamInMinutes = hourExam*60;
  13. var hourArriveInMinutes = hourArrive*60;
  14.  
  15. var hourExamTotal = hourExamInMinutes + minuteExam;
  16. var hourArriveTotal = hourArriveInMinutes + minuteArrive;
  17.  
  18.  
  19. if ((hourExamTotal - hourArriveTotal)>=0 && (hourExamTotal - hourArriveTotal)<=30)
  20.  
  21. {
  22. Console.WriteLine("On time");
  23. }
  24. else if ((hourArriveTotal - hourExamTotal)>0)
  25. {
  26. Console.WriteLine("Late");
  27. }
  28. else
  29.  
  30. {
  31. Console.WriteLine("Early");
  32. }
  33.  
  34. if ((hourExamTotal - hourArriveTotal)>=0 && (hourExamTotal - hourArriveTotal)<60)
  35. {
  36. Console.WriteLine("{0} minutes before the start",Math.Abs(hourExamTotal - hourArriveTotal));
  37. }
  38. else if ((hourExamTotal - hourArriveTotal)>=60)
  39. {
  40. int hours = Math.Abs(hourExamTotal - hourArriveTotal)/60;
  41. int minutes = Math.Abs(hourExamTotal - hourArriveTotal)%60;
  42.  
  43.  
  44. Console.WriteLine("{0}:{1:00} hours before the start",hours, minutes);
  45. }
  46.  
  47. else if ((hourArriveTotal - hourExamTotal) >=0 && (hourArriveTotal - hourExamTotal) <60)
  48. {
  49. Console.WriteLine("{0} minutes after the start",Math.Abs(hourExamTotal - hourArriveTotal));
  50. }
  51. else if ((hourArriveTotal -hourExamTotal>=60))
  52. {
  53. int hours = Math.Abs(hourExamTotal - hourArriveTotal)/60;
  54. int minutes = Math.Abs(hourExamTotal - hourArriveTotal)%60;
  55.  
  56.  
  57. Console.WriteLine("{0}:{1:00} hours after the start",hours, minutes);
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement