Program 4 • Logic Programming : Prolog” Solution

$30.00

Description

1. Logic Programming in Prolog

You will use Prolog to write an airline reservation system for the Twilight Zone Air-lines. Given a request to travel from one city to another, print out the flight schedule. For each leg of the trip, print out the departure airport, airport, city name, and time. For example :

| ?- fly( lax, sea).

depart LAX Los Angeles 14:22

arrive SFO San Francisco 15:29

depart SFO San Francisco 16:02

arrive SEA Seattle-Tacoma 17:42

true ?

yes

A database has been provided which lists some airports, their cities, and the North latitudes and West longitudes of the airports. A flight schedule has also been pro-vided listing the departure and arrival airports and the departure times.

2. Logic

Some notes about the logic of the program.

    1. To compute the distance between airports, use the HAVERSINE FORMULA. Note that the database contains degrees and minutes, which must be converted to radians. The result must be converted to miles.

    1. All flight times are in Twilight Zone Standard Time (TZST), so you don’t need to handle PST, PDT, etc.

    1. Planes fly at a constant speed of 500 miles per hour and always using great circle paths, so the arrival time can be computed from the departure time.

    1. A flight transfer always takes 30 minutes, so during a transfer at a hub, the departure of a connecting flight must be at least 30 minutes later than the arrival of the incoming flight.

    1. There are no overnight trips. The complete trip must depart and arrive in the same day.

    1. See the notes on using the Haversine formula for computing great circle dis-tances.

  1. What to Submit

Submit one file : functions.pl. Also submit README, and if applicable, PARTNER. The grader will copy in the files .score/database.pl and the test data.


error: Content is protected !!