Advertisement
Guest User

ExamSchedule

a guest
Dec 6th, 2014
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System;
  2. using System.Globalization;
  3. using System.Threading;
  4.  
  5. class ExamSchedule
  6. {
  7.     static void Main()
  8.     {
  9.         CultureInfo cultureEnUS = new CultureInfo("en-US");
  10.         Thread.CurrentThread.CurrentCulture = cultureEnUS;
  11.         string hour = Console.ReadLine();
  12.         string minutes = Console.ReadLine();
  13.         string partOfDay = Console.ReadLine();
  14.         string durationHours = Console.ReadLine();
  15.         string durationMinutes = Console.ReadLine();
  16.  
  17.         string startString = hour + ":" + minutes + partOfDay;
  18.         DateTime examStart = DateTime.Parse(startString);
  19.         string durationString = durationHours + ":" + durationMinutes;
  20.         TimeSpan examDuration = TimeSpan.Parse(durationString);
  21.         DateTime examEnd = examStart.Add(examDuration);
  22.         Console.WriteLine("{0:hh:mm:tt}", examEnd);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement