Question: i need help in my project it is about a restaurant system the code should be written in prolog language (fact , rules , query)

i need help in my project it is about a restaurant system the code should be written in prolog language (fact , rules , query)

i wrote this code but it has an error i don't know where is the problem i need fixing for my code please modify the following so it matches the following requirement:

the idea of the program depends on providing a varied list of good fast food meals. for example. burger meals and pizza meals for the user, in addition, providing a feature for making suggestions which recommends a meal to user based on user preferences. such as the system will ask the user some questions and based on the user answers the system will suggest to the user a meal.

also I need at least 8 queries

% Define facts for food options

food_type(burger).

food_type(pizza).

topping(cheese).

topping(mushrooms).

topping(onions).

topping(pepperoni).

size(small).

size(medium).

size(large).

side(fries).

side(salad).

side(onion_rings).

substitution(no).

substitution(yes).

drink(no).

drink(yes).

dessert(no).

dessert(yes).

% Define rules for meal suggestions

suggest_meal(FoodType, Toppings, Size, Sides, Substitutions, Drink, Dessert, Meal) :-

food_type(FoodType),

member(Toppings, [cheese, mushrooms, onions, pepperoni]),

size(Size),

member(Sides, [fries, salad, onion_rings]),

substitution(Substitutions),

drink(Drink),

dessert(Dessert),

Meal = "Special " + FoodType + " with " + Toppings + ", " + Size + " size, " + Sides + ", " + Substitutions + " substitutions, " + Drink + " drink, and " + Dessert + " dessert.".

% Define queries for user input

ask_food_type :-

write("What type of food would you like to order? (burger/pizza)"),

read(FoodType),

assert(food_type(FoodType)).

ask_toppings :-

write("Would you like to add any toppings? (yeso)"),

read(Toppings),

assert(topping(Toppings)).

ask_size :-

write("What size would you like your meal to be? (small/medium/large)"),

read(Size),

assert(size(Size)).

ask_sides :-

write("Would you like any sides with your meal? (fries/salad/onion rings)"),

read(Sides),

assert(side(Sides)).

ask_substitutions :-

write("Would you like to make any substitutions in your meal? (yeso)"),

read(Substitutions),

assert(substitution(Substitutions)).

ask_drink :-

write("Would you like to add a drink to your order? (yeso)"),

read(Drink),

assert(drink(Drink)).

ask_dessert :-

write("Would you like to add a dessert to your order? (yeso)"),

read(Dessert),

assert(dessert(Dessert)).

% Suggest meal based on user input

suggest_order :-

ask_food_type,

ask_toppings,

ask_size,

ask_sides,

ask_substitutions,

ask_drink,

ask_dessert,

suggest_meal(FoodType, Toppings, Size, Sides, Substitutions, Drink, Dessert, Meal),

write("Based on your choices, we suggest the following meal: "),

write(Meal), nl,

write("Would you like to order this meal? (yeso)"),

read(Order),

(

(Order == yes)

-> write("Thank you for your order!")

; write("Okay, let's try again.")

).

The error :

i need help in my project it is about a restaurant system

SWISH File Edit v Examples v Help v Singleton variables: [FoodType, Toppings, Size, Sides, Substitutions, Drink, Dessert] ic Singleton variables: [FoodType, Toppings, Size, Sides, Substitutions, Drink, Dessert] ask_dessert, [3] assert(food_type(pizza)) suggest_meal(FoodType, Toppings, Size, Sides, Substitutions, Drink, Des [1] suggest_order at if line 76 write("Would you like to order this meal? (yeso)"), ?- suggest_order

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!