using System; class TimeReading { /// /// The Time Reading Program Bishop and Horspool April 2002 /// ======================== /// Still calculates the time in a city given an offset from /// another one, but uses reading to enable the second city /// to be set at runtime. /// Shows reading string and int values. /// void Go() { Console.WriteLine("The Time Reading Program"); string city; int offset; int startTime = 14; DateTime now = DateTime.UtcNow; //Read in the second city's details Console.Write("City? "); city = Console.ReadLine(); Console.Write("Offset from London? "); offset = int.Parse(Console.ReadLine()); DateTime meeting = new DateTime(now.Year,now.Month,now.Day, startTime,0,0); Console.WriteLine("The meeting in London is " + " scheduled for " + meeting); Console.WriteLine(city + " is " + offset + " hours different"); DateTime offsetMeeting = meeting.AddHours(offset); Console.WriteLine("The meeting in " + city + " will be at " + offsetMeeting.ToShortTimeString()); } static void Main() { new TimeReading().Go(); } }