|
-
March 23rd, 2016, 01:47 PM
#1
pass parameters from java to prolog
I have the code below using swi Prolog and I made a interface using jframe in netbeans.
In this jframe I have textbox for answer and another textbox for grade.i want take answer from textbox and pass to start predicate in prolog to process answer. Can anyone tell me how I can do that? The only thing that I know is how to call predicate.
start(Answer,Total_grade):-
Question1 = "Define computer?",
Word_list1 = ["software","operatingsystem"],
Word_list2 = ["hardware","tools"],
Msg = "Write your answers ",
write(Question1),nl,
write(Msg),nl,nl,
read(Answer),
string_lower(Answer,Low_answer),
split_string(Low_answer," ,.()-_"," ,.()-_", Answer_in_list),
find(Answer_in_list,Word_list1,Grade1),
find(Answer_in_list,Word_list2,Grade2),
Total_grade is Grade1 + Grade2,
nl,write("Your grade is : "), write(Total_grade),nl.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|