Complete fact table in slide 24 and write prolog program Slide 24: Slide 25 : Sl
ID: 3780498 • Letter: C
Question
Complete fact table in slide 24 and write prolog program
Slide 24:
Slide 25 :
Slide 26 :
---------------------------------------------------------------------
Complete fact table and write prolog program
Question 3: Consider the problem taken from life insurance expert (slides 24-27 Chapter 6 (expert systems). Write a complete Prolog program that could support the decision of a life insurance expert. Add necessary facts and rules to produce a well-designed knowledge base. int: follow the coding sample example shown in slide 26 For example, if we want to find out whether the insurance risk of (Khalid) is high or low, we could write a query like insurance(khalid). Then the system will ask the following questions: What is your age? 55. What is your gender? Male. Do you smoke? yes. Based on the user's answers for the above questions. the system will print the following results The insurance risk of Khalid is high.Explanation / Answer
insurance(X) :- risk(X,Y),write('The insurance risk of '),write(X),write(' is '),write(Y).
risk(X,high) :- age(X,old),gender(X,male),smoker(X).
risk(X,high) :- age(X,middle),gender(X,male),smoker(X).
risk(X,low) :- age(X,young),gender(X,male),smoker(X).
risk(X,low) :- age(X,old),gender(X,male),~smoker(X).
risk(X,low) :- age(X,middle),gender(X,male),~smoker(X).
risk(X,low) :- age(X,young),gender(X,male),~smoker(X).
risk(X,low) :- age(X,middle),gender(X,female),~smoker(X).
risk(X,high) :- age(X,old),gender(X,female),smoker(X).
risk(X,high) :- age(X,old),gender(X,female),~smoker(X).
risk(X,high) :- age(X,middle),gender(X,female),smoker(X).
risk(X,low) :- age(X,young),gender(X,female),smoker(X).
risk(X,low) :- age(X,young),gender(X,female),~smoker(X).
age(_,Y):- write('what is your age ?'),read(Age) ,checkage(Age,Y).
checkage(Age,old) :- Age>=50.
checkage(Age,middle) :- Age<50 ,Age>30.
checkage(Age,young) :- Age<=20.
smoker(_) :- 'Do you smoke ?',read(Pref),smoker(Pref).
smoker(yes).
gender(X,Y):- write('what is your gender ?'),read(Gender) ,gender(X,Gender).
gender(X,Male).
gender(X,Female).
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.