The O’Hare Affair

You want to meet a friend at O’Hare airport at noon and return home the same day. Given a date and an origin airport, find the pair of nonstop flights that gets you to Chicago and home again on that date, minimizing your total time away from home, subject to the constraint that you are at O’Hare at noon. 

Your program, which must be written in Java, will work by scraping ourhttp://matrix2.itasoftware.comwebsite. Your program should accept two command-line inputs as follows: 

java -jar OHareAffair.jar YYYY-MM-DD airportCode

The program should navigate to and pose a round-trip query between the given airportCode and O’Hare (ORD),limited to nonstop flights only, using BOS as the sales city, with appropriate date and time constraints. The program should then scan the resulting solution set for solutions that meet the objective specified above.No more than 15 http requests should be made of per invocation.Finally, details of the three shortest solutions (breaking ties arbitrarily) should be written out in human-readable form to the console.

For example, for a traveler from Baltimore on July 4th, your program might be invoked as follows: 

java -jar OHareAffair.jar 2006-07-04 BWI

Sample output:

Travelling round-trip from BWI to ORD on 2006-07-04:
Trip length: 6:21
Outbound: American Airlines Flight AA3991 (10:03a-11:04a)
Return: United Airlines Flight UA1236 (1:30p-4:24p)
Trip length: 6:39
Outbound: United Airlines Flight UA641 (9:45a-10:47a)
Return: United Airlines Flight UA1236 (1:30p-4:24p)
Trip length: 6:54
Outbound: American Airlines Flight AA3991 (10:03a-11:04a)
Return: American Airlines Flight AA4009 (2:09p-4:57p)

Strive to make your code clean and robust, and to report errors cleanly. Be sure to include your source, any necessary libraries, and instructions on how to run it. 


Read More


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.