Topics: Functions, Dictionary, I/O Problem description: Write a python application to simulate an online shopping system, namely "Shoppers Stop". The purpose of this assignment is to gain experience in Python dictionary structure and create basic Python function. Design solution: The program will have a list of all products sold on Shoppers Stop which is provided in the template file. Each product consists only one String of comma-separated data: product_id, category, description, cost, and average customer rating. A customer would like to purchase some products by first input the category name, then asked whether a filter should be applied based on minimum customer rating, if so, a list of filtered products is printed. The user will then enter the product_id in that category. If the user input an invalid category name, the program should provide a list of valid category names and ask the user input the category name again. The user can stop shopping by input "checkout", which trigger the checkout() function that computes the total cost of the products in the cart. A customer will be promoted the following messages while shopping at Shoppers Stop: 1. Please input a category name or input 'checkout' to quit: 1) if user inputs 'checkout' go to 4. 2) else if user inputs a valid category name go to 2. 3) otherwise, ask the user again to "Please input a category name or input 'checkout' to quit:" 2. The user is asked if he would like to see a list of filtered products based on customer rating, for the chosen category. 1) if yes, the minimum rating is retrieved from user 2) else, go to 3. 3. Display all the products in the specified category, and inside the entered range (if applicable) and ask the user "Please input product ID or type any key to return" 1) if user input a valid product ID, add the product ID to the cart (i.e. a list of product ID purchased) 2) else go back to 1. 4. Display all the purchased products with their information and the total cost of these products. Notes: • You will need to build two dictionaries before Step 1: o dict_ID: key is the product ID, value is a list of product's category, description, and cost. o dict_category: key is the category name, value is a list of product IDs. • The cart should be implemented as a list of product ID. • I f user chooses to use the customer rating, the product ID with minimum ratings will be saved in another list.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section: Chapter Questions
Problem 8PP: (Data processing) A bank’s customer records are to be stored in a file and read into a set of arrays...
icon
Related questions
Question

please make sure the code follows sample output highlighted in light blue 

Topics: Functions, Dictionary, I/0
Problem description: Write a python application to simulate an online shopping system, namely
"Shoppers Stop". The purpose of this assignment is to gain experience in Python dictionary structure
and create basic Python function.
Design solution: The program will have a list of all products sold on Shoppers Stop which is provided
in the template file. Each product consists only one String of comma-separated data: product_id,
category, description, cost, and average customer rating. A customer would like to purchase some
products by first input the category name, then asked whether a filter should be applied based on
minimum customer rating, if so, a list of filtered products is printed. The user will then enter the
product_id in that category. If the user input an invalid category name, the program should provide a
list of valid category names and ask the user input the category name again. The user can stop
shopping by input "checkout", which trigger the checkout() function that computes the total cost of
the products in the cart. A customer will be promoted the following messages while shopping at
Shoppers Stop:
1. Please input a category name or input 'checkout' to
quit: 1) if user inputs 'checkout' go to 4.
2) else if user inputs a valid category name go to 2.
3) otherwise, ask the user again to "Please input a category name or input 'checkout' to quit:"
2. The user is asked if he would like to see a list of filtered products based on customer
rating, for the chosen category.
1) if yes, the minimum rating is retrieved from user
2) else, go to 3.
3. Display all the products in the specified category, and inside the entered range (if
applicable) and ask the user "Please input product ID or type any key to return"
1) if user input a valid product ID, add the product ID to the cart (i.e. a list of product ID purchased)
2) else go back to 1.
4. Display all the purchased products with their information and the total cost of these products.
Notes:
• You will need to build two dictionaries before Step 1:
o dict_ID: key is the product ID, value is a list of product's category,
description, and cost. o dict_category: key is the category name, value is a list
of product IDs.
The cart should be implemented as a list of product ID.
• f user chooses to use the customer rating, the product ID with minimum ratings will be
saved in another list.
Transcribed Image Text:Topics: Functions, Dictionary, I/0 Problem description: Write a python application to simulate an online shopping system, namely "Shoppers Stop". The purpose of this assignment is to gain experience in Python dictionary structure and create basic Python function. Design solution: The program will have a list of all products sold on Shoppers Stop which is provided in the template file. Each product consists only one String of comma-separated data: product_id, category, description, cost, and average customer rating. A customer would like to purchase some products by first input the category name, then asked whether a filter should be applied based on minimum customer rating, if so, a list of filtered products is printed. The user will then enter the product_id in that category. If the user input an invalid category name, the program should provide a list of valid category names and ask the user input the category name again. The user can stop shopping by input "checkout", which trigger the checkout() function that computes the total cost of the products in the cart. A customer will be promoted the following messages while shopping at Shoppers Stop: 1. Please input a category name or input 'checkout' to quit: 1) if user inputs 'checkout' go to 4. 2) else if user inputs a valid category name go to 2. 3) otherwise, ask the user again to "Please input a category name or input 'checkout' to quit:" 2. The user is asked if he would like to see a list of filtered products based on customer rating, for the chosen category. 1) if yes, the minimum rating is retrieved from user 2) else, go to 3. 3. Display all the products in the specified category, and inside the entered range (if applicable) and ask the user "Please input product ID or type any key to return" 1) if user input a valid product ID, add the product ID to the cart (i.e. a list of product ID purchased) 2) else go back to 1. 4. Display all the purchased products with their information and the total cost of these products. Notes: • You will need to build two dictionaries before Step 1: o dict_ID: key is the product ID, value is a list of product's category, description, and cost. o dict_category: key is the category name, value is a list of product IDs. The cart should be implemented as a list of product ID. • f user chooses to use the customer rating, the product ID with minimum ratings will be saved in another list.
The program needs to be case sensitive. Customer can enter the name that can have
all small letter but the program should still be able to find the categories and product
ID in the corresponding dictionary.
• You need to use the product list in the template file, and implement two build dictionary
functions and the checkout function. All other code should be implemented in the main
function.
• To receive full credits, you will need to figure out to generate the very similar input/output as
shown in two provided samples.
Sample I/0 1:
Welcome to shopping at Shoppers Stop!
We sell products in the following categories: ['book', 'clothing', 'food]
Please input a category name or input 'checkout' to quit: book
Would you like to see products in this category filtered by minimum customer ratings (0-5)? Y/N: Y
Please enter the minimum rating: 4
Product ID: BO04 Information: ['book', 'Grant', ' 22.50', ' 4.2']
Please input product ID or type any key to return:
BO04 BO04 added to cart
Welcome to shopping at Shoppers Stop!
Please input a category name or input 'checkout' to quit: checkout
Thanks for shopping at Shoppers Stop. You purchased the following
product(s):
BO04 ("book', 'Grant', '22.50', ' 4.2']
The amount is: $ 22.5
Sample I/0 2:
Welcome to shopping at Shoppers Stop!
We sell products in the following categories: ['book', 'clothing', 'food']
Please input a category name or input 'checkout' to quit: book
Would you like to see products in this category filtered by minimum customer ratings (0-5)? Y/N: Y
Please enter the minimum rating: 4
Product ID: BO04 Information: ['book', 'Grant', ' 22.50', ' 4.2']
Please input product ID or type any key to return:
b004 BO04 added to cart
Welcome to shopping at Shoppers Stop!
We sell products in the following categories: ['book', 'clothing', 'food']
Please input a category name or input 'checkout' to quit: clothing
Would you like to see products in this category filtered by minimum customer ratings (0-5)? Y/N: Y
Please enter the minimum rating: 3.7
Product ID: CO04 Information: ['clothing', 'Wool Hat', ' 14.00', ' 4.5')
Product ID: CO05 Information: ['clothing', 'Wrangler Jeans', ' 24.50', ' 4.1']
Product ID: CO06 Information: ['clothing', 'Nike T-shirt',' 19.00','5')
Product ID: CO08 Information: ['clothing', 'North Face Fleece Jacket', ' 89.95', ' 4.3']
Please input product ID or type any key to return: c008
Co08 added to cart:
Welcome to shopping at Shoppers Stop!
We sell products in the following categories: ['book', 'clothing',
'food')
Please input a category name or input 'checkout' to quit: checkout
Thanks for shopping at Shoppers Stop. You purchased the following
product(s):
b004 ['book', 'Grant', ' 22.50', ' 4.2']
c008 ['clothing', 'North Face Fleece Jacket', ' 89.95','
4.3'] The amount is: $ 112.45
Transcribed Image Text:The program needs to be case sensitive. Customer can enter the name that can have all small letter but the program should still be able to find the categories and product ID in the corresponding dictionary. • You need to use the product list in the template file, and implement two build dictionary functions and the checkout function. All other code should be implemented in the main function. • To receive full credits, you will need to figure out to generate the very similar input/output as shown in two provided samples. Sample I/0 1: Welcome to shopping at Shoppers Stop! We sell products in the following categories: ['book', 'clothing', 'food] Please input a category name or input 'checkout' to quit: book Would you like to see products in this category filtered by minimum customer ratings (0-5)? Y/N: Y Please enter the minimum rating: 4 Product ID: BO04 Information: ['book', 'Grant', ' 22.50', ' 4.2'] Please input product ID or type any key to return: BO04 BO04 added to cart Welcome to shopping at Shoppers Stop! Please input a category name or input 'checkout' to quit: checkout Thanks for shopping at Shoppers Stop. You purchased the following product(s): BO04 ("book', 'Grant', '22.50', ' 4.2'] The amount is: $ 22.5 Sample I/0 2: Welcome to shopping at Shoppers Stop! We sell products in the following categories: ['book', 'clothing', 'food'] Please input a category name or input 'checkout' to quit: book Would you like to see products in this category filtered by minimum customer ratings (0-5)? Y/N: Y Please enter the minimum rating: 4 Product ID: BO04 Information: ['book', 'Grant', ' 22.50', ' 4.2'] Please input product ID or type any key to return: b004 BO04 added to cart Welcome to shopping at Shoppers Stop! We sell products in the following categories: ['book', 'clothing', 'food'] Please input a category name or input 'checkout' to quit: clothing Would you like to see products in this category filtered by minimum customer ratings (0-5)? Y/N: Y Please enter the minimum rating: 3.7 Product ID: CO04 Information: ['clothing', 'Wool Hat', ' 14.00', ' 4.5') Product ID: CO05 Information: ['clothing', 'Wrangler Jeans', ' 24.50', ' 4.1'] Product ID: CO06 Information: ['clothing', 'Nike T-shirt',' 19.00','5') Product ID: CO08 Information: ['clothing', 'North Face Fleece Jacket', ' 89.95', ' 4.3'] Please input product ID or type any key to return: c008 Co08 added to cart: Welcome to shopping at Shoppers Stop! We sell products in the following categories: ['book', 'clothing', 'food') Please input a category name or input 'checkout' to quit: checkout Thanks for shopping at Shoppers Stop. You purchased the following product(s): b004 ['book', 'Grant', ' 22.50', ' 4.2'] c008 ['clothing', 'North Face Fleece Jacket', ' 89.95',' 4.3'] The amount is: $ 112.45
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Knowledge Booster
Operations of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning