Question

%flu sympton(flu,cough). sympton(flu,sneeze). sympton(flu,stomach_ach). %hangover sympton(hangover,cough). sympton(hangover,feeling_dizzy). sympton(hangover,stomach_ach). %headache sympton(headache,pain). symptom(headache,hurting). sympton(headache,cant_t

%flu

sympton(flu,cough).

sympton(flu,sneeze).

sympton(flu,stomach_ach).

%hangover

sympton(hangover,cough).

sympton(hangover,feeling_dizzy).

sympton(hangover,stomach_ach).

%headache

sympton(headache,pain).

symptom(headache,hurting).

sympton(headache,cant_think).

im making a swi-prolog program i need to enter the inputs and then output the disease let say i enter stomach_ach the disease that should come back is 'hangover' i dont know how to deal with that and what if the users what to enter mutliple results let say the user enter stomach_ach,pain, sneeze,feeling_dizzy, base on what the user enter it should output the disease of what the users might have headache,flu,hangover.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

getSymptoms([Symptom|List]):-
writeln('Symptom:'),
read(Symptom),
dif(Symptom,stop),
getSymptoms(List)

getSymptoms([]).

disease(flu):-
symptom(cough),
symptom(sneeze),
symptom(stomach_ache).

disease(headache):-
symptom(pain),
symptom(hurting),
symptom(cant_think).

disease(hangover):-
symptom(cough),
symptom(feeling_dizzy),
symptom(stomach_ache).

Add a comment
Know the answer?
Add Answer to:
%flu sympton(flu,cough). sympton(flu,sneeze). sympton(flu,stomach_ach). %hangover sympton(hangover,cough). sympton(hangover,feeling_dizzy). sympton(hangover,stomach_ach). %headache sympton(headache,pain). symptom(headache,hurting). sympton(headache,cant_t
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Suppose that we want to help physicians to diagnose illnesses. A physician observes a patient's symptoms and considers the illnesses that could be associated with those symptoms. Design and implem...

    Suppose that we want to help physicians to diagnose illnesses. A physician observes a patient's symptoms and considers the illnesses that could be associated with those symptoms. Design and implement a class PhysiciansHelper thatprovide a list of those illnesses. PhysiciansHelper should contain a dictionary of illnesses and symptoms. A method should read a text file of illnesses and their symptoms into the dictionary. See format in sample data file. PhysiciansHelper should read a list of symptoms for a patient. A...

  • A complex number is a number in the form of a + bi, where a and...

    A complex number is a number in the form of a + bi, where a and b are real numbers and i is the square root of negative 1. Design and create a class called Complex for representing complex numbers. This class should have two attributes, a and b, which represent the parts of the complex number. This class should overload the +,-,*,/,++ and -- operators (both prefix and suffix) to perform basic complex number calculations according to the following...

  • So I can not get this to work properly and he does not want us using...

    So I can not get this to work properly and he does not want us using an array list. Below is the directions along with the code I have(Im not sure the code is in the right format)   ITSE 2321 – OBJECT-ORIENTED PROGRAMMING JAVA Program 7 – Methods: A Deeper Look Write a program that will help an elementary school student learn multiplication. Use a SecureRandom object to produce two positive one-digit integers. The program should then prompt the student...

  • An infant is admitted to the neonatal intensive care unit(NICU) with exstrophy of the bladder. What...

    An infant is admitted to the neonatal intensive care unit(NICU) with exstrophy of the bladder. What covering should the nurse use to protect the exposed area? Loose diaper Dry sterile gauze dressing Moist sterile dressing Petroleum jelly gauze pad 1. 2. What is the most appropriate nursing diagnosis for the child with acute glomerulonephritis? Excess Fluid Volume related to decreased plasma filtration Excess Fluid volume related to fluid accumulation in tissue and third spaces. Deficient fluid volume related to excessive...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT