Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions

Question

Is the person willing to deal with the consequences?

Answered: 1 week ago

Question

Was there an effort to involve the appropriate people?

Answered: 1 week ago