Question: Programming language: prolog 3. Create a Prolog database by typing the facts listed below in a pro file. Consult the file in Amzi Prolog. We

Programming language: prolog

Programming language: prolog 3. Create a Prolog database by typing the facts

3. Create a Prolog database by typing the facts listed below in a pro file. Consult the file in Amzi Prolog. We have a person relation to keep track of the person's id number, name, gender and age. The facts for this relation are person (1, al, M, 20). person (2, bea, F, 22) person (3, jack, M, 21). person (4, tina, F, 30) person (5, ted, M, 19) We have an activities relation to keep track of an activity's id number, name, hours per session and cost. The facts for this relation are activity (al, racquetball, 1, 40). activity (a2, fencing, 2, 80). activity (a3, swimming, 1,25). activity (a4, tennis, 2, 90). Finally, we have a volunteers relation which keeps track of the id of a person volunteering to help with an activity, the id of the activity and the day in which the person volunteers. The facts for this relation are volunteers (1, al, tuesday). volunteers (2, a2, wednesday). volunteers (3, al, monday). volunteers (4, a2, thursday) volunteers (5, al, wednesday). volunteers (1, a2, tuesday). volunteers (2, al, wednesday). volunteers (3, a2, thursday) volunteers (4, al, monday). volunteers (5, a2, thursday). volunteers (1, a3, friday). volunteers (2, a4, thursday). volunteers (3, a3, monday volunteers (4, a4, saturday). volunteers (5, a3, tuesday). Write the following predicates and test them in Amzi Prolog: The predicate listPersonIds should return the ids and names of all persons who have indicated that they are willing to volunteer The predicate findVolunteerDay will ask the user (using read) to enter a person's name and an activity and will print (using write) the day that the person volunteers for the activity 3. Create a Prolog database by typing the facts listed below in a pro file. Consult the file in Amzi Prolog. We have a person relation to keep track of the person's id number, name, gender and age. The facts for this relation are person (1, al, M, 20). person (2, bea, F, 22) person (3, jack, M, 21). person (4, tina, F, 30) person (5, ted, M, 19) We have an activities relation to keep track of an activity's id number, name, hours per session and cost. The facts for this relation are activity (al, racquetball, 1, 40). activity (a2, fencing, 2, 80). activity (a3, swimming, 1,25). activity (a4, tennis, 2, 90). Finally, we have a volunteers relation which keeps track of the id of a person volunteering to help with an activity, the id of the activity and the day in which the person volunteers. The facts for this relation are volunteers (1, al, tuesday). volunteers (2, a2, wednesday). volunteers (3, al, monday). volunteers (4, a2, thursday) volunteers (5, al, wednesday). volunteers (1, a2, tuesday). volunteers (2, al, wednesday). volunteers (3, a2, thursday) volunteers (4, al, monday). volunteers (5, a2, thursday). volunteers (1, a3, friday). volunteers (2, a4, thursday). volunteers (3, a3, monday volunteers (4, a4, saturday). volunteers (5, a3, tuesday). Write the following predicates and test them in Amzi Prolog: The predicate listPersonIds should return the ids and names of all persons who have indicated that they are willing to volunteer The predicate findVolunteerDay will ask the user (using read) to enter a person's name and an activity and will print (using write) the day that the person volunteers for the activity

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!