
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
please make sure the code follows sample output highlighted in light blue

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](https://content.bartleby.com/qna-images/question/9eb2eb60-aea6-4c2b-bdb3-b0b3ca45de12/a49d5599-0d52-46ab-be0d-abc2065cd436/nm520tm_thumbnail.png)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 6 images

Knowledge Booster
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
- can u please send screenshot of code for the alignement/ indentation thank youarrow_forwardThe register file shown is 8 x 8 (8 registers, each register is 8 bits wide). For the waveforms given, show the values of VO-V3. Show hex values with two digits, i.e., "Ox7C". Show unknown values as "XX." (No explanation required) Rd_addr 2 Wr_addr Wr Wr_data CIK 4 clk Wr_addr Wr_data Wr Rd0_addr Rd0_data 2 OxA7 VO Rd_data 5 5 0x36 V1 1 OXAE 2 V2 6 OxCB 1 V3arrow_forwardUse the Volts.txt file finding the Highest volt and lowest along with the amp and time of the occurrencearrow_forward
- please do not change variable name. will give thumbs down if variable name is changed. also please have it so I can copy and pastearrow_forwardThe following code is used to plot a heatmap and the result is shown below. The range of the data that represented using the heatmap is of the range from 0 to 600. It can be seen that the numbers over 400 are all shown in the same color. How would you improve the figure to allow the data with higher values to be stood out? inpert talatlaelat a plt rughts s. leattasetuts', ta ta ruts tiure tt. .heataptaftaghts, in, ptt.shol Ha gers -300 -250 200 -100 O a. Set the parameter vmax to a smaller number. O b. Reverse the color bar. Oc. Set the parameter vmax to a larger number. O d. Show the annotation on the figure.arrow_forwardflowchart of this pseudocode using online chartarrow_forward
- Q1 Which of the following statements is true if x (a character array) is added (+) to a y (2 x 2 double)? Select one: a. Variable x will be converted into a double and then concatenated with y to create new ASCII-type variable b. The addition operation (+) cannot be performed c. Variable y will be converted into a string and then concatenated with x to create a new string-type variable d. ASCII values of x are added to y to create a new double-type variable e. It is equivalent to the statement x == y and creates a logical-type variable Q2 Consider the following non-linear equation where x is the independent variable, y is the dependent variable, and A and B are constants. Which of the following is the resulting gradient variable in linearised form? Select one: a. B b. log10(B) c. log(-A) d. A e. exp(B) Q3 Which of the following statements is false for the function header below? function [cat, ox, dragon] = rat(pig, snake) Select one:…arrow_forwardWith a single line of code create binned variables with 4 equal width bins for the variables 'UnsecLines', 'Age', and 'MonthlyIncome'Set. Use lambda function within the apply() function. Using a for loop print frequency distribution for each of the binned variables from above. Make sure the bins in the frequency distribution are properly sorted.arrow_forwardNEED HELP WITH PYTHON CODE. ALSO, PLEASE PROVIDE DETAILS SEPARATELY ON HOW AND WHAT DID U USE TO GET UR CODE DONE.arrow_forward
- Again, modify the while loop to utilize tolower() or toupper(). Create two more functions (options #3 and #4 in your menu) by taking the to_kilograms() and to_pounds() functions and modifying them to use reference variables instead of normal pass by value variables. Name them: to_kilograms_ref() to_pounds_ref() Create another two functions (options #5 and #6 in your menu) by taking the to_kilograms() and to_pounds() functions and modifying them to use pointers instead of normal pass by value variables. Name them: to_kilograms_ptr() to_pounds_ptr() Your new Menu should look like this, which includes what type of variables are being used: MENU 1. Kilograms to Pounds (pass by value) 2. Pounds to Kilograms (pass by value) 3. Kilograms to Pounds (pass by reference) 4. Pounds to Kilograms (pass by reference) 5. Kilograms to Pounds (using pointers) 6. Pounds to Kilograms (using pointers) Example: #include <iostream> #include <cmath>…arrow_forwardEXCEL VBA (a) Write a user-defined function called SumStop which takes an integer n as an input and adds up the values of the cells in row 1 (starting from cell A1) until the value of the sum exceeds n, and then outputs the number of cells used. You may assume that all of the cells in row 1 contain numbers. Use a suitable Do While loop and the cells command. Declare all variable types and include appropriate comments in your code.arrow_forward10010110 (Excess-M binary number) = (base 10)? You need to type in the calculation steps or insert the picture of your handwriting using "insert" menu above.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education