Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i need a explanation in details for this prolog code nain : - welcome. welcome :- write('Welcone to the Counselling Dot!'), n1,n1, write('How are you
i need a explanation in details for this prolog code
nain : - welcome. welcome :- write('Welcone to the Counselling Dot!'), n1,n1, write('How are you feeling? (happy/sad)'), r, write(' ;>), read(ANS1), checkmood (/NS1). checkmood(happy) : n1, write('Please share us why you are feeling happy today!'), nl, write("1. Meaningful Relationships with Others'), nl, wrile('2, Academic Achievemenls') , nl, write('3. Maintaining a Pleasant Hobby or Work'), n1, write('4. Giving Back to the Community'), nl, write('5. Enjoyed Great Food'), nl,n1, write('Enter number from 1 to 5 , whichever that suits you best''), nl, write(':s '), read(ANS2), checkhappy (ANS2). checkmood(sad) :- nl, write('Please share us why you are feeling sad today?'), nl, write('1, Depression'), nl, write('2. Anxiety'), ni, write('3. Stress'), nl, n1, write('select your reason: "), nl, wrile('; "), read(Reason), nl, write('Enter scale of Depression/Anxiety/stress (1-10) '), nl, write(';s "), read(Scale), reason(Reason, scale). checkmodd( ) : n1, write('Invalid input. Please try again'), n1,n1,n1, welcome. masernit sralay. Ln 1. Col 1 27C File Edit View File Edit View read(ANS3), checkhabit(ANS3). checkhappy(3) :- nl, write('That is amazing! I Ceel so happy (or you!'), nl, nl, write('Do you still want to continue maintaining a pleasant work or hobby you have right now? (y)'), nl, nl, write(';s '), read(ANS3), checkhabit(ANS3). checkhappy (4) : n1, write('That is amazing! I feel 50 happy for you!' ), nl, nl, write('Do you still want to continue giving back to the community? (y)),n1,n1, write("; "), read(ANS3), checkhabit(ANS3). checkhappy(5) :- n1, write('That is amazing! T feel so happy for you!' ,,n1,n1, write('Do you still want to enjoy the rood you just had? (y)),n1,n1, write(":> "), read(ANS3), checkhahit(ANS3). checkhappy(_) :- nl, write('Invalid input. Please try again'), nl, nl, checkmood(happy). checkhabit(y) :- nl, write('Greatl we hope you can continue honing your habitsl'), nl, n1, end. checkhabil(n) :- nl, write('That is okay! be hope you find great success in your future endeavors!'), nl, nl, end. checkhabit(_) : n1, write('Invalid input. Please try again'), n1,nl, checkmood(happy). Ln 1 , Col 1 File Edit View n1, write('That is amazing! I feel so happy for you!' ), nl, nl, write('Do you still want to continue maintaining a pleasant work or hobby you have right now? (y/r)'), nl, nl, write(":> "), read(AHS3), checkhabit( Nr53). checkhappy(A) : n1, write('That is amazing! I feel 50 happy for you!' ,,n1,n1, write('Do you still want to continue giving back to the community? (y)),n1,n1, wrile(";> "), read(ANS3), checkhabit(AN53). checkhappy(5) : n, write('That is amazing! I feel so happy for you!' ),n1,n1, write('Do you still want to enjoy the food you just had? (y)),n1,n1, write("; "), read(A\|S3), checkhabit(ANS3). checkhappy(_) :- nl, write('Invalid input. Please try again'), nl, nl, checkmood(happy). checkhabil(y) :- n1, write('Greatl We hope you can continue honing your habitsl'), n1, n1, end. checkhabit(n) ; nl, write('That is okay! we hope you find great success in your future endeavors!'), nl, nl, end. checkhabit(_): n1, write('Invalid input. Please try again'), nl, nl, checkmood(happy). end : write('Thank you for using Counselling Bot!' ), nl,nl, write('Have a nice day!'). bye, L 1 , Col 1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started