Expert System Application
Expert System which we made is about horoscope. Horoscope is a prediction of someone's future based on the relative positions of the planets (Source : Google).
Everyone absolutely have horoscope. So, We want to help everyone to know his/her horoscope by entering date and month of their birthday.
The logic to make the program which can show a horoscope, the program must have a function to receive input date and month of their birthday. Then the program will check the program like this :
- Date of born 22 December -19 January, the program conclude the horoscope is Capricorn.
- Date of born 20 January -18 February, the program conclude the horoscope is Aquarius.
- Date of born 19 February -20 March, the program conclude the horoscope is Pisces.
- Date of born 21 March -19 April, the program conclude the horoscope is Aries.
- Date of born 20 April - 20 May, the program conclude the horoscope is Taurus.
- Date of born 21 May - 21 June, the program conclude the horoscope is Gemini.
- Date of born 22 June - 22 July, the program conclude the horoscope is Cancer.
- Date of born 23 July - 22 August, the program conclude the horoscope is Leo.
- Date of born 23 August -22 September, the program conclude the horoscope is Virgo.
- Date of born 23 September-23 October, the program conclude the horoscope is Libra.
- Date of born 24 October – 21 November, the program conclude the horoscope is Scorpio.
- Date of born 22 November- 21 December, the program conclude the horoscope is Sagittarius.
So, We can write the source code like this :
get_answer(Ans1,Ans2):-repeat,write('Enter the date (ended by writing dot mark) : '),read(Ans1),write('Enter your birth month (ended by writing dot mark) : '),read(Ans2),member(Ans1,[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]),member(Ans2,[january,february,march,april,may,june,july,august,september,october,november,december]),nl,nl,write('Your birthday is '),write(Ans1),write(' '),write(Ans2),nl,(Ans2==january,Ans1<20,write('So, Your Horoscope is : Capricorn'),nl;Ans2==february,Ans1>28,write('It is Imposible, because February just have 28 days !!'),nl;Ans2==december,Ans1>21,write('So, Your Horoscope is : Carpicorn'),nl;Ans2==january,Ans1>19,write('So, Your Horoscope is : Aquarius'),nl;Ans2==february,Ans1<19,write('So, Your Horoscope is : Aquarius'),nl;Ans2==february,Ans1>18,Ans1<29,write('So, Your Horoscope is : Pisces'),nl;Ans2==march,Ans1<21,write('So, Your Horoscope is : Pisces'),nl;Ans2==march,Ans1>20,write('So, Your Horoscope is : Aries'),nl;Ans2==april,Ans1<20,write('So, Your Horoscope is : Aries'),nl;Ans2==april,Ans1>19,Ans1<31,write('So, Your Horoscope is : Taurus'),nl;Ans2==april,Ans1==31,write('It is Imposible, because April just have 30 days !!'),nl;Ans2==may,Ans1<21,write('So, Your Horoscope is : Taurus'),nl;Ans2==may,Ans1>20,write('So, Your Horoscope is : Gemini'),nl;Ans2==june,Ans1<22,write('So, Your Horoscope is : Gemini'),nl;Ans2==june,Ans1>21,Ans1<31,write('So, Your Horoscope is : Cancer'),nl;Ans2==june,Ans1==31,write('It is Imposible, because June just have 30 days !!'),nl;Ans2==july,Ans1<23,write('So, Your Horoscope is : Cancer'),nl;Ans2==july,Ans1>22,write('So, Your Horoscope is : Leo'),nl;Ans2==august,Ans1<23,write('So, Your Horoscope is : Leo'),nl;Ans2==august,Ans1>22,write('So, Your Horoscope is : Virgo'),nl;Ans2==september,Ans1<23,write('So, Your Horoscope is : Virgo'),nl;Ans2==september,Ans1>22,Ans1<30,write('So, Your Horoscope is : Libra'),nl;Ans2==september,Ans1==31,write('It is Imposible, because September just have 30 days !!'),nl;Ans2==october,Ans1<24,write('So, Your Horoscope is : Libra'),nl;Ans2==october,Ans1>23,write('So, Your Horoscope is : Scorpio'),nl;Ans2==november,Ans1<23,write('So, Your Horoscope is : Scorpio'),nl;Ans2==november,Ans1>21,Ans1<31,write('So, Your Horoscope is : Sagittarius'),nl;Ans2==november,Ans1==31,write('It is Imposible, because November just have 30 days !!'),nl;Ans2==december,Ans1<22,write('So, Your Horoscope is : Sagittarius'),nl),!.
(Click the image if can't see well)
For start the program, entering command get_answer(Variabel1,Variabel2). For example : We use Variabel "Date" and "Month.
Note : variabel must writing a upper case in every first character of name. For example : "Date". Not allowed if you write "date".
(Click the image if can't see well)
(Click the image if can't see well)
(Click the image if can't see well)
The Result :
(Click the image if can't see well)
0 comments:
Post a Comment