Question: Python help! Imagine that you are helping to build a store management system for your own restaurant. Given the following lists, write a program that
Python help!
Imagine that you are helping to build a store management system for your own restaurant. Given the following lists, write a program that asks the user for a product name. Next, find out if the restaurant sells that item and report the status to the user. Allow the user to continually inquire about product names until they elect to quit the program.
Here are some lists to get you started. Go ahead and change the kind of food for your restaurant!
# product lists product_names = ["hamburger", "cheeseburger", "small fries"] product_costs = [0.99, 1.29, 1.49]
And heres a sample running of your program:
(s)earch for product or (q)uit: s Enter a product name: hamburger We sell "hamburger" at 0.99 per unit (s)earch for product or (q)uit: s Enter a product name: salad Sorry, we don't sell "salad" (s)earch for product or (q)uit: Python Invalid option, try again (s)earch for product or (q)uit: q See you soon!
Inventory
Next, extend your program so that it keeps track of how many products the store currently has to sell. Default the store to have 10 hamburgers, 5 cheeseburgers, and 20 small fries. Hint: you might want to create a new list to store this data! Once you have this information in place you should modify your program to do the following.
Update the search feature to include a report of how many products the store currently has.
Add a new feature that lists all products, their prices, and the amount the restaurant has available to sell.
Heres a sample running of your program:
(s)earch, (l)ist or (q)uit: s Enter a product name: hamburger We sell "hamburger" at 0.99 per unit We currently have 10 in stock (s)earch, (l)ist or (q)uit: l Product Price Quantity hamburger 0.99 10 cheeseburger 1.29 5 small fries 1.49 20 (s)earch, (l)ist or (q)uit: s Enter a product name: pikachu Sorry, we don't sell "pikachu" (s)earch, (l)ist or (q)uit: q See you soon!
Adding Products
Next, add in an add feature that lets users add a new product to the store. When you add a product you will need to ask the user for the name of the product, the cost of the product and how many items the store has available to sell. Validate this datayou cannot add a product that already exists and both the price and inventory amount must be positive. Heres a sample running of the program:
(s)earch, (l)ist, (a)dd or (q)uit: l Product Price Quantity hamburger 0.99 10 cheeseburger 1.29 5 small fries 1.49 20 (s)earch, (l)ist, (a)dd or (q)uit: a Enter a new product name: cheeseburger Sorry, we already sell that product. Try again. Enter a new product name: dbl cheeseburger Enter a product cost: 0 Invalid cost. Try again. Enter a product cost: 1.49 How many of these products do we have? -5 Invalid quantity. Try again. How many of these products do we have? 100 Product added! (s)earch, (l)ist, (a)dd or (q)uit: l Product Price Quantity hamburger 0.99 10 cheeseburger 1.29 5 small fries 1.49 20 dbl cheeseburger 1.49 100 (s)earch, (l)ist, (a)dd or (q)uit: s Enter a product name: dbl cheeseburger We sell "dbl cheeseburger" at 1.49 per unit We currently have 100 in stock (s)earch, (l)ist, (a)dd or (q)uit: q See you soon!
Removing Products
Next, add in a remove feature that lets users remove products from the database. Heres a sample running of the program:
(s)earch, (l)ist, (a)dd, (r)emove or (q)uit: l Product Price Quantity hamburger 0.99 10 cheeseburger 1.29 5 small fries 1.49 20 (s)earch, (l)ist, (a)dd, (r)emove or (q)uit: r Enter a product name: pikachu Product doesn't exist. Can't remove. (s)earch, (l)ist, (a)dd, (r)emove or (q)uit: r Enter a product name: small fries Product removed! (s)earch, (l)ist, (a)dd, (r)emove or (q)uit: l Product Price Quantity hamburger 0.99 10 cheeseburger 1.29 5 (s)earch, (l)ist, (a)dd, (r)emove or (q)uit: r Enter a product name: hamburger Product removed! (s)earch, (l)ist, (a)dd, (r)emove or (q)uit: l Product Price Quantity cheeseburger 1.29 5 (s)earch, (l)ist, (a)dd, (r)emove or (q)uit: q See you soon!
Modifying Products
Add in the ability to modify a product. Users should be able to modify the name, cost or quantity of a product. Note that you will need to perform data validation as needed. Heres a sample running of your program:
(s)earch, (l)ist, (a)dd, (r)emove, (u)pdate or (q)uit: l Product Price Quantity hamburger 0.99 10 cheeseburger 1.29 5 small fries 1.49 20 (s)earch, (l)ist, (a)dd, (r)emove, (u)pdate or (q)uit: u Enter a product name: burger Product doesn't exist. Can't update. (s)earch, (l)ist, (a)dd, (r)emove, (u)pdate or (q)uit: u Enter a product name: hamburger What would you like to update? (n)ame, (c)ost or (q)uantity: n Enter a new name: cheeseburger Duplicate name! Enter a new name: hamburger royale Product name has been updated (s)earch, (l)ist, (a)dd, (r)emove, (u)pdate or (q)uit: l Product Price Quantity hamburger royale 0.99 10 cheeseburger 1.29 5 small fries 1.49 20 (s)earch, (l)ist, (a)dd, (r)emove, (u)pdate or (q)uit: u Enter a product name: cheeseburger What would you like to update? (n)ame, (c)ost or (q)uantity: c Enter a new cost: 0 Invalid cost! Enter a new cost: 9.50 Product cost has been updated (s)earch, (l)ist, (a)dd, (r)emove, (u)pdate or (q)uit: l Product Price Quantity hamburger royale 0.99 10 cheeseburger 9.50 5 small fries 1.49 20 (s)earch, (l)ist, (a)dd, (r)emove, (u)pdate or (q)uit: u Enter a product name: small fries What would you like to update? (n)ame, (c)ost or (q)uantity: q Enter a new quantity: -500 Invalid quantity! Enter a new quantity: 30 Product quantity has been updated (s)earch, (l)ist, (a)dd, (r)emove, (u)pdate or (q)uit: l Product Price Quantity hamburger royale 0.99 10 cheeseburger 9.50 5 small fries 1.49 30 (s)earch, (l)ist, (a)dd, (r)emove, (u)pdate or (q)uit: u Enter a product name: hamburger royale What would you like to update? (n)ame, (c)ost or (q)uantity: nothing Invalid option (s)earch, (l)ist, (a)dd, (r)emove, (u)pdate or (q)uit: q See you soon!
Product Reporting
Finally, add in a reporting feature to your program that finds the highest priced product, the lowest priced product, and the total value of all inventory in the store (product cost * product quantity). Heres a sample running of your program:
(s)earch, (l)ist, (a)dd, (r)emove, (u)pdate, r(e)port or (q)uit: l Product Price Quantity hamburger 0.99 10 cheeseburger 1.29 5 small fries 1.49 20 (s)earch, (l)ist, (a)dd, (r)emove, (u)pdate, r(e)port or (q)uit: e Most expensive product: 1.49 (small fries) Least expensive product: 0.99 (hamburger) Total value of all products: 46.15 (s)earch, (l)ist, (a)dd, (r)emove, (u)pdate, r(e)port or (q)uit: q See you soon!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
