Function name main add_to_cart display_by_price display_by_brand display_by_rating checkout parameter Mst None cart, Items min_price, max_price, items brand_name, items user_rating items cart return value None Returns True if name found In Items otherwise returns False Returns matched Items list if within the price range Returns matched_items list Returns matched items list total Description will generate the user menu and call other functions depending on user choice. function asks name and user quantity first. name is the user Input which describes the item user wants to purchase, quantity is the total number of items user want to purchase. cart list is one containing the Item name, price, rating and quantity user wants to purchase and Items is the master list contains all the items in the store. Items list is provided. min_price, max_price are the user defined range. Program will check if any item falls within that price range and then add to the matched_items list. Program will check if any item matches with the brand name and then add to the matched_items list. Program will check if any item rating is to user ratings and then add to the matched items list. Iterate over each item in the cart, obtain the name, price, rating and quantity for purchased items and count the

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter6: Looping
Section: Chapter Questions
Problem 5GZ
icon
Related questions
Question
Write a python language code
<board.learn.xythos.prod/5a30bcf95ea52/60802521?X-Blackboard-S3-Bucket-blackboard.lea...
7
50%
Function name
main
add_to_cart
display_by_price
display by brand
display by rating
checkout
parameter
list
None
cart, items
min_price,
max_price,
items
brand name,
items
user rating
items
return value
None
Returns True if
name found in
Items otherwise
returns False
Returns
matched_items
list if within the
price range
Returns
matched_items
list
Returns
matched items
list
total
Description
will generate the user menu
and call other functions
depending on user choice.
function asks name and user
quantity first. name is the user
Input which describes the item
user wants to purchase,
quantity is the total number of
items user want to purchase.
cart list is one containing the
Item name, price, rating and
quantity user wants to purchase
and Items is the master list
contains all the items in the
store. items list is provided.
min_price, max_price are the
user defined range. Program
will check if any item falls
within that price range and then
add to the matched items list.
Program will check if any item
matches with the brand name
and then add to the
matched items list.
Program will check if any item
rating is to user ratings and
then add to the matched items
St
Iterate over each item in the
cart, obtain the name price.
rating and quantity for
purchased items and count the
Transcribed Image Text:<board.learn.xythos.prod/5a30bcf95ea52/60802521?X-Blackboard-S3-Bucket-blackboard.lea... 7 50% Function name main add_to_cart display_by_price display by brand display by rating checkout parameter list None cart, items min_price, max_price, items brand name, items user rating items return value None Returns True if name found in Items otherwise returns False Returns matched_items list if within the price range Returns matched_items list Returns matched items list total Description will generate the user menu and call other functions depending on user choice. function asks name and user quantity first. name is the user Input which describes the item user wants to purchase, quantity is the total number of items user want to purchase. cart list is one containing the Item name, price, rating and quantity user wants to purchase and Items is the master list contains all the items in the store. items list is provided. min_price, max_price are the user defined range. Program will check if any item falls within that price range and then add to the matched items list. Program will check if any item matches with the brand name and then add to the matched items list. Program will check if any item rating is to user ratings and then add to the matched items St Iterate over each item in the cart, obtain the name price. rating and quantity for purchased items and count the
actor Requested.
board.learn.xythos.prod/5a30bcf95ea52/60802521?X-Blackboard-S3-Bucket-blackboard.lea.
7
X
58%
Teung oF DICERbot The user can quie dhe program of Syping AL
1. Purchase clothes by name (name)-this option will prompt for the name of the item
and quantity. Once the input is received, the program will call the add_to_cart function.
This function will go over each item in the items list, check if the name entered by user
matches with the name in the items list, if match found it will add to the cart list and
returns True. Otherwise returns False.
2. Purchase clothes by price range (price) - this option will prompt for min price and max
price. Once the input is received, the program will call the display_by_price() function.
This function will first define an empty list matched_items where matched items will be
stored. It will go over each item in the items list, separate the price for each item and
check if the price is within the user range, if match found it will append to the
matched_items. This function returns matched_items.
3. Purchase clothes by brand (brand)- this option will prompt for a brand name. Once the
input is received, the program will call the display_by_brand() function. This function
will first define an empty list matched_items where matched items will be stored. It will
go over each item in the items list, and check if the price matches with the brand
provided by the user, if match found it will append to the matched_items. This function
returns matched_items.
4. Purchase clothes by rating (rating): this option will prompt the user for a rating. Once
the input is received, the program will call display_by_rating() function. This function
will first define an empty list matched_items where matched items will be stored. It will
go over each item in the items list, and check if the rating of the item is greater than or
equal to the user provided rating, if match found it will append to the matched_items.
This function returns matched_items.
5. Checkout (checkout) - this option will take the user to checkout function. Checkout
function will display the total price for the purchase. It will go over each item in the cart
list, multiply the quantity with each item's price and keep adding it to the total variable.
6. Main function. The program also has a main function, which will manage the main
functionality of the code including the user input and function calling. Details below.
b
64
Transcribed Image Text:actor Requested. board.learn.xythos.prod/5a30bcf95ea52/60802521?X-Blackboard-S3-Bucket-blackboard.lea. 7 X 58% Teung oF DICERbot The user can quie dhe program of Syping AL 1. Purchase clothes by name (name)-this option will prompt for the name of the item and quantity. Once the input is received, the program will call the add_to_cart function. This function will go over each item in the items list, check if the name entered by user matches with the name in the items list, if match found it will add to the cart list and returns True. Otherwise returns False. 2. Purchase clothes by price range (price) - this option will prompt for min price and max price. Once the input is received, the program will call the display_by_price() function. This function will first define an empty list matched_items where matched items will be stored. It will go over each item in the items list, separate the price for each item and check if the price is within the user range, if match found it will append to the matched_items. This function returns matched_items. 3. Purchase clothes by brand (brand)- this option will prompt for a brand name. Once the input is received, the program will call the display_by_brand() function. This function will first define an empty list matched_items where matched items will be stored. It will go over each item in the items list, and check if the price matches with the brand provided by the user, if match found it will append to the matched_items. This function returns matched_items. 4. Purchase clothes by rating (rating): this option will prompt the user for a rating. Once the input is received, the program will call display_by_rating() function. This function will first define an empty list matched_items where matched items will be stored. It will go over each item in the items list, and check if the rating of the item is greater than or equal to the user provided rating, if match found it will append to the matched_items. This function returns matched_items. 5. Checkout (checkout) - this option will take the user to checkout function. Checkout function will display the total price for the purchase. It will go over each item in the cart list, multiply the quantity with each item's price and keep adding it to the total variable. 6. Main function. The program also has a main function, which will manage the main functionality of the code including the user input and function calling. Details below. b 64
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
JQuery and Javascript
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT