CMPS-112 • Project 4 • Logic Programming : Prolog” solution

$30.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (9 votes)

1. Logic Programming in Prolog
You will use Prolog to write an airline reservation system for the Twilight Zone Airlines. 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 provided 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 ha versine formula. Note
that the database contains degrees and minutes, which must be converted to
radians. The result must be converted to miles.
2. All flight times are in Twilight Zone Standard Time (TZST), so you don’t need
to handle PST, PDT, etc.
3. 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.
4. 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.
5. There are no overnight trips. The complete trip must depart and arrive in the
same day.
3. 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.