Hi this is a question I ran into when I was going through some question sets. The knowledge base is given with the following information,
boat(Boat_ID, Boat_name, color,fare_per_passenger)
The question says to write a procedure to do the following,
to obtain the boat identification number together with the fare per passenger increased by 5%.
I wrote the procedure as,
boat(BID,_,_,F), F is F*1.05.
Prolog keeps returning me with a message saying false any idea?
The answer to this question was,
boat(BID,_,_,F), Nfare is F*1.05.
the issue was with using the same variable for the arithmetic operation as well.
Credit to Daniel Lyons for mentioning it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.