Question: can someone help with this prolog In this assignment, you are given a city database (facts) and will need to write queries and rules that

can someone help with this prolog

In this assignment, you are given a city database (facts) and will need to write queries and rules that use the facts. here is the given code:

city_altitude(tempe, az, 1318).

city_altitude(atlanta, ga, 894).

city_altitude(chicago, il, 583).

city_altitude(denver, co, 5280).

city_altitude(seattle, wa, 260).

city_altitude(boise, id, 2704).

city_altitude(saltlakecity, ut, 4226).

Add two more facts by choosing two cities and adding them to the facts including their state and altitude.

Queries: (a) What is the answer after executing the following query? city_altitude(City, _, _).

(b) Write a Prolog query to return all pairs of each city and its altitude in the database. (Do not display their state) Rules: a) Write a prolog rule that confirms the following statement: City is a high city if its altitude in feet is greater than 1000 ft. i.e., define the new predicate: high_city(City):- ...... b) Write a prolog rule to compute each citys altitude in meters. Note that an altitude in meters can be computed as 0.3048 * altitude in feet. i.e., define the new predicate: city_altitude_in_meters(City, State, Feet, Meters):- ......

the following queries can be used to test the rules, You can also replace X or Y with names of people to see if Prolog answer the query correctly using the rule.

|?-high_city(City).

|?-city_altitude_in_meters(City,State, Feet, Meters).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!