

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Skeleton Program:
manager :- getCommand(Command), executeCommand(Command, Status), displayReport(Command, Status), fail.
manager :- write_ln(‘Good Bye!’).
Note:
Types of Commands:
There are several types of commands. Required arguments are listed in red – all the others are optional. ITEM is an abbreviation for item(model(Model), name(Name), brand(Brand)), where only Model is required.
delivery(ITEM, count(Count), price(Price)).
A new shipment of Count of Items arrived, each priced at Price dollars. For example:
delivery(item(model(1234),name(dvd), brand(sony)), count(20), price(99))
delivery(item(model(1234),name(), brand()), count(20), price(99))
order(customer(Customer), ITEM, count(Count), max_price(MaxPrice), type(Type)). where Type = new | _.
Customer wants to purchase Count of Items of a given Type, assuming they are available and the price is <= MaxPrice. If Type=new then customer wants only new items, otherwise open-box (returned) items are also acceptable. For example:
order(customer(ann),item(model(1234),name(), brand(sony)), count(2), max_price(300), type())
Satisfy the customer’s order as much as possible. If there are no Count items available, sell as many as are available.
return(customer(Customer), ITEM, count(Count) )
A Customer wants to return Count of unwanted Items. Verify that the customer indeed placed an order for these items and did not yet return them. If so, return all the items (or as many as are eligible) back into stock but mark them as "open_box" items and reduce their price by 20%. When selling "open_box" items to customers who are willing to accept them, inform customers about it.
For example: return(customer(ann), item(model(1234), name(), brand()), count(2) )
sale( model(Model), name(Name), brand(Brand), percentage(Percentage))
All the merchandise matching Model, Name and/or Brand is now on sale and their prices must be lowered by the given Percentage. This applies to both new and open-box items. Percentage is an integer between 1 and
sale( model(_), name(dvd), brand(sony), percentage(15))
inventory(model(Model), name(Name), brand(Brand), type(Type) )
Prints a detailed inventory list of all items currently in stock that match the given Model, Name, Brand and Type, where where Type = new | open_box | _ .. For example:
inventory(model(), name(dvd), brand(), type(new) )
Good Luck!