Spare parts inventory assistant

Spare parts inventory assistant#

Problem#

https://upload.wikimedia.org/wikipedia/commons/c/cf/Comercio_en_la_plaza_del_9_de_abril_de_1947%2C_T%C3%A1nger%2C_Marruecos%2C_2015-12-11%2C_DD_78.JPG

Fig. 13 Seller posing in a grocery and cosmetics shop in Morocco
CC BY-SA 4.0. By Diego Delso. Source: Wikimedia Commons
#

You will program a chat assistant that gives information about the availability of industrial spare parts in the inventory. The assistant repeatedly asks the user which part they need and the user replies whether they would like to have or not.

The parts in the inventory are: hydraulic pump, PLC module, servo motor.

The assistant starts the conversation with

Hej. Welcome to the spare parts inventory!

Which part do you need?

Then, in a loop, repeatedly ask the user which parts they need. If you user enters the exact name of a part that is in the inventory, affirm that you have the part in the format:

I have got {part} here for you 😊. Bye!

If the user does not enter the exact name:

I am afraid we don’t have any {part} in the inventory πŸ˜”

There can also be special queries like:

  • Do you actually have any parts?

  • Is there anything in stock at all?

Then the assistant must reply with the number of parts and their names, one on each line:

We have {part_count} part(s)!

The program exits, only after the assistant affirms that a part is available.

Sample interaction#

Hej. Welcome to the spare parts inventory!
Which part do you need? gripper
I am afraid we don't have any gripper in the inventory πŸ˜”
Which part do you need? plc module
I am afraid we don't have any plc module in the inventory πŸ˜”
Which part do you need? PLC module
I've got PLC module here for you 😊
(program exits)

Another run:

Hej. Welcome to the spare parts inventory!
Which part do you need? pLC module
I am afraid we don't have any pLC module in the inventory πŸ˜”
Which part do you need? screws
I am afraid we don't have any screws in the inventory πŸ˜”
Which part do you need? Do you actualy have any parts?
We have 3 part(s)!
hydraulic pump
PLC module
servo motor
Which part do you need? quit
I am afraid we don't have any quit in the inventory πŸ˜”
Which part do you need? servo motor
I've got servo motor here for you 😊

Activity 10

Draw a flowchart for this problem.

Steps:

  1. 3 min work individually

  2. 2 min compare your result with your partner

Activity 11

Similar to Activity 8. Name your project SparePartsInventoryAssistant.