Al G.

asked • 12/08/22

How to correct the prolog full stop in clause body error?

weather(phoenix, spring, hot).

weather(phoenix, summer, hot).

weather(phoenix, fall, hot).

weather(phoenix, winter, warm).

weather(wellington, spring, warm).

weather(wellington, summer, warm).

weather(wellington, fall, hot).

weather(wellington, winter, cold).

weather(toronto, spring, cold).

weather(toronto, summer, hot).

weather(toronto, fall, cold).

weather(toronto, winter, cold).


warmer_than(C1, C2) :-

weather(C1, spring, hot),

weather(C2, spring, warm).


colder_than(C1, C2) :-

weather(C1, winter, cold),

weather(C2, winter, warm).


weatherquestions :-

warmer_than(phoenix, X),

write('Phoenix is warmer than '), write(X), nl.

colder_than(X, toronto),

write('Toronto is colder than '), write(X), nl.

warmer_than(X, wellington),

write('The city/cities warmer than Wellington are '), write(X), nl.

colder_than(X, phoenix),

write('The city/cities colder than Phoenix are '), write(X), nl.

colder_than(X, toronto),

warmer_than(X, wellington),

write('The city/cities colder than Toronto and warmer than Wellington are '), write(X), nl.

print_all_warmer_than(X) :-

warmer_than(X, phoenix),

write('The cities warmer than Phoenix are '), write(X), nl.

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.