Computer Science: An Overview (12th Edition)
Computer Science: An Overview (12th Edition)
12th Edition
ISBN: 9780133760064
Author: Glenn Brookshear, Dennis Brylow
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 6, Problem 57CRP

Explanation of Solution

Extended prolog program:

The prolog program to find the family relationship using the prolog rule is shown below:

%"carol" is a female

female(carol).

%"sue" is a female

female(sue).

%"bill" is a male

male(bill).

%"john" is a male

male(john).

%"john" is parent of "carol"

parent(john, carol).

%"sue" is parent of "carol"

parent(sue, carol).

%This rule for find the mother for given child

mother(X, Y) :- parent(X, Y), female(X).

%This rule for find the father for given child

father(X, Y) :- parent(X, Y), male(X).

%This rule for sibling

%It means that X is Y's sibling if X and Y have a common parent

sibling(X, Y) :- parent(Z, X), parent(Z, Y), X\=Y.

%Rule for find the relationship of uncle

uncle(U,N):- male(U),sibling(U,Z),parent(Z,N).

%Rule for find the relationship of aunt

aunt(X,N):- female(X),sibling(X,Z),parent(Z,N).

%Rule for find the relationship of grandParent

grandParent(G,N):- parent(G,P),parent(P,N).

%Rule for find the relationship of cousin

cousin(X1,X2) :-

     parent(Y1,X1),

     parent(Y2,X2),

     sibling(Y1,Y2).

%Rule for find the parents of Z's.

parents(X, Y, Z):- parent(X, Z), parent(Y, Z).

Prolog Code Explanation:

The given program is used to find the family relationship using prolog rule.

  • From the above code, first assign the two females “carol” and “sue” by using prolog rule “female(carol)” and “female(sue)” respectively.
  • Then assign the two males “bill” and “john” by using prolog rule “male(bill)” and “male(john)” respectively.
  • The rule “parent(john, carol)” implies “john” is parent of “carol”.
  • The rule “parent(sue, carol)” implies “sue” is parent of “carol”...

Blurred answer
Students have asked these similar questions
Finish the 2 "TODO" in the ASM Language! A palindrome is a word that is spelled the same way forwards and backwards. For example, "radar", "racecar", "civic", "kayak", and "madam" are all palindromes. The definition can be extended to phrases and sentences when ignore case and punctuation, but for this exercise we will stick to a single word. The starter code provided uses the C library functions printf and scanf to prompt for an input a word. The word that is entered from the keyboard is a null-terminated string placed in the byte array at address buf. There are also two output strings provided at addresses str_is_palindrome and str_is_not_palindrome. The starter code provided simply outputs the string at str_is_not_palindrome. The code contains two TODO comments... At the first TODO comment, the byte array at buf is filled with input from the keyboard. This input is a null-terminated character string (i.e. the array contains the characters entered on the keyboard, followed by ASCII…
Can someone please help me with this question?
Your task for this lab is to write a program in any language you like(c language) to determine the number of rabbits we would have in 24 months.  You can check the validity and correctness of your program by testing the count at month 3, 4, and 5 to see if it matches the pair count in the diagram.

Chapter 6 Solutions

Computer Science: An Overview (12th Edition)

Ch. 6.3 - Why do many programming languages implement I/O...Ch. 6.3 - Prob. 4QECh. 6.3 - Prob. 5QECh. 6.4 - Prob. 1QECh. 6.4 - What is a symbol table?Ch. 6.4 - What is the difference between a terminal and a...Ch. 6.4 - Prob. 4QECh. 6.4 - Prob. 5QECh. 6.4 - Prob. 6QECh. 6.5 - What is the difference between an object and a...Ch. 6.5 - Prob. 2QECh. 6.5 - Suppose the classes PartTimeEmployee and...Ch. 6.5 - What is a constructor?Ch. 6.5 - Why are some items within a class designated as...Ch. 6.6 - Prob. 1QECh. 6.6 - Prob. 2QECh. 6.6 - Prob. 3QECh. 6.7 - Prob. 2QECh. 6.7 - Prob. 3QECh. 6.7 - Prob. 4QECh. 6 - Prob. 1CRPCh. 6 - Translate the following Python program into the...Ch. 6 - Prob. 3CRPCh. 6 - Why was it necessary to identify the type of data...Ch. 6 - Prob. 6CRPCh. 6 - Suppose the function f expects two numeric values...Ch. 6 - Suppose f is a function that returns the result of...Ch. 6 - Prob. 9CRPCh. 6 - Summarize the distinction between a machine...Ch. 6 - John Programmer argues that the ability to declare...Ch. 6 - Summarize the distinction between declarative...Ch. 6 - Explain the differences between a literal, a...Ch. 6 - a. What is operator precedence? b. Depending on...Ch. 6 - Prob. 16CRPCh. 6 - What is the difference between the meaning of the...Ch. 6 - Draw a flowchart representing the structure...Ch. 6 - Prob. 19CRPCh. 6 - Prob. 20CRPCh. 6 - Draw a flowchart representing the structure...Ch. 6 - Rewrite the following program segment using a...Ch. 6 - Summarize the following rats-nest routine with a...Ch. 6 - Prob. 24CRPCh. 6 - Prob. 25CRPCh. 6 - Suppose the variable X in a program was declared...Ch. 6 - Prob. 27CRPCh. 6 - Why would a large array probably not be passed to...Ch. 6 - Sometimes an actual parameter is passed to a...Ch. 6 - Prob. 32CRPCh. 6 - What ambiguity exists in the statement X = 3 + 2 ...Ch. 6 - Suppose a small company has five employees and is...Ch. 6 - Prob. 35CRPCh. 6 - Prob. 36CRPCh. 6 - Prob. 37CRPCh. 6 - Prob. 38CRPCh. 6 - Prob. 39CRPCh. 6 - Design a set of syntax diagrams that describes the...Ch. 6 - Prob. 41CRPCh. 6 - Prob. 42CRPCh. 6 - Add syntax diagrams to those in Question 5 of...Ch. 6 - Prob. 44CRPCh. 6 - What code optimization could be performed by a...Ch. 6 - Simplify the following program segment Y = 5 if (Y...Ch. 6 - Simplify the following program segment while (X !=...Ch. 6 - In an object-oriented programming environment, how...Ch. 6 - Describe how inheritance might be used to develop...Ch. 6 - What is the difference between the public and...Ch. 6 - a. Give an example of a situation in which an...Ch. 6 - Describe some objects that might be found in a...Ch. 6 - Prob. 53CRPCh. 6 - Prob. 54CRPCh. 6 - Prob. 55CRPCh. 6 - Prob. 56CRPCh. 6 - Prob. 57CRPCh. 6 - Prob. 58CRPCh. 6 - Prob. 59CRPCh. 6 - In general copyright laws support ownership rights...Ch. 6 - By using a high-level programming language, a...Ch. 6 - Prob. 3SICh. 6 - Prob. 4SICh. 6 - Prob. 5SICh. 6 - Suppose an amateur programmer writes a program for...Ch. 6 - Prob. 7SI
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education