Imagine that you plan to apply for a programming position at an airline. Before inter- viewing, you need to have a good idea of how airlines calculate flight arrival times. There- fore, you will create a simple application that explores this concept. Your application will calculate the arrival time of any airline flight. The user selects the local departure date and time, the departure airport, and the arrival airport. Then the application calculates the local arrival date and time. It displays this information, along with the trip duration.

It is reasonable to assume that airlines use Coordinated Universal Time (UTC) when cal- culating departure and arrival times. (Appendix B explains how to convert between local time and UTC time, with examples.) Figure 2-48 shows information for a flight from Miami to Honolulu. The departure date is selected in a DateTimePicker control, and the departure time is entered into a text box. When the user selects a departure airport, arrival airport, date, and time and clicks the Continue button, the arrival date and time appear on the right side of the form. Figure 2-49 shows information for an overnight flight from Honolulu to Miami. Notice that the arrival date is one day later than the departure date. See image. See next image.

Implementation Notes

If the user clicks the Continue button without selecting departure and arrival airports, use an ErrorProvider control to signal the error. Do not let the program calculate dates and times until airports are selected. Create some application data, similar to the fol- lowing:

Private airports As String() = {''MIA'', ''JFK'', ''HNL'', ''LAX'', ''DFW''} Private utcOffsets As Integer() = {-4, -4, -10, -7, -5} Private travelTimes As Double(,) = {{0, 3, 12, 8, 2.5}, _ {3, 0, 14, 8.5, 3.5}, {12, 14, 0, 4.5, 8.5}, _ {8, 8.5, 4.5, 0, 3.5}, {2.5, 3.5, 8.5, 3.5, 0}}

The airports array holds several airport identification codes. The utcOffsets array holds the UTC offsets of the corresponding airports. The travelTimes array holds the esti- mated travel time, in hours, between two airports and all the other airports. It is a two- dimensional array. Row 0, for example, represents the time to travel between MIA (Miami) and the following airports: MIA, JFK, HNL, LAX, and DFW. Row 1 represents the time to travel between JFK (New York) and the following airports: MIA, JFK, HNL, LAX, and DFW. The times listed here may very well be incorrect, so feel free to change them.

A suggested approach is to use three steps in your calculations: (1) Convert the local departure time into UTC time; (2) add the trip’s duration, resulting in the UTC arrival time; and (3) convert the UTC arrival time into the arrival airport’s local time.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.