Question: You are writing a program for an online dating website. Assume you have the following profiles from different people. The profile is the format of

 You are writing a program for an online dating website. Assume

You are writing a program for an online dating website. Assume you have the following profiles from different people. The profile is the format of name, sex, height(in cm), age, education(hs, bs, ms, phd). Profiles: person(lily, female, 180, 30, phd). person(jenny, female, 167, 25, hs). person(bob, male, 180, 40, phd). person(richard, male, 190, 30, masters). person(tom, male, 177, 29, hs). You know from experience that a woman will only date a man if 1. 2. 3. he is at least as tall as she is, his educational level is at least as high as hers, he is not younger, and no more than 10 years older than her a) Write a recursive rule degree lower(A,B) in Prolog that succeeds if the educational degree A is lower than or equal to B ?- degree lower (hs, hs) yes ?- degree lower (hs, bs). yes ?- degree lower (hs.phd). yes ?- degree lower (phd.ms). no b) Write a Prolog predicate dateable(Female,Male) which encodes the dating rules above: ?- dateable(lily, richard). no ?- dateable(lily, bob). yes ?- dateable(jenny.tom). yes Note: Include a printout that shows your query and the program's responses (you may simply copy this from SWI-Prolog's main window). You are writing a program for an online dating website. Assume you have the following profiles from different people. The profile is the format of name, sex, height(in cm), age, education(hs, bs, ms, phd). Profiles: person(lily, female, 180, 30, phd). person(jenny, female, 167, 25, hs). person(bob, male, 180, 40, phd). person(richard, male, 190, 30, masters). person(tom, male, 177, 29, hs). You know from experience that a woman will only date a man if 1. 2. 3. he is at least as tall as she is, his educational level is at least as high as hers, he is not younger, and no more than 10 years older than her a) Write a recursive rule degree lower(A,B) in Prolog that succeeds if the educational degree A is lower than or equal to B ?- degree lower (hs, hs) yes ?- degree lower (hs, bs). yes ?- degree lower (hs.phd). yes ?- degree lower (phd.ms). no b) Write a Prolog predicate dateable(Female,Male) which encodes the dating rules above: ?- dateable(lily, richard). no ?- dateable(lily, bob). yes ?- dateable(jenny.tom). yes Note: Include a printout that shows your query and the program's responses (you may simply copy this from SWI-Prolog's main window)

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!