Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem description: Please find a python application to simulate an Amazon online book shopping system, namely Amazing. The attachments hold 2 samples I/O of how

Problem description: Please find a python application to simulate an Amazon online book shopping system, namely "Amazing". The attachments hold 2 samples I/O of how the code should look like. Please let me know if you have any questions. Thank you!

Design solution: The program will have lists of all books sold on Amazing along with available titles, publication years, author names, and their prices which are provided in the template file. Each piece of information is a list, i.e., book titles, authors, publication years, and price are each separate lists of either strings or numbers. A customer would like to purchase some items by first entering which list they would like to see to get information about the books. This is followed by entering the number of books they want to purchase. The program should then ask if the customer would like to choose the book by entering its' title, year, author, or price. Your code should then find the corresponding title from the title list and keep adding those to the cart. Once all the books are added, it should trigger "checkout" and return the sum of prices of all books selected. A customer will be prompted with the following messages while shopping at Amazing:

1. Press 1 to get title of available books as a list.

Press 2 to get year of publication of available books as a list

Press 3 to get writer of available books as a list

Press 4 to get price range of available books (as min and max values)

  1. if user inputs 'checkout' go to 4.
  2. else if user inputs a valid option go to 2.

2. Print the list of customer's interests from 1.

4. Display all the purchased items (including only the titles) and the total cost of these items. Notes:

3. Ask the customer to enter the number of books they would like to purchase

  1. If they have chosen title in 1, keep asking for and appending titles to the cart
  2. otherwise, find the corresponding title and add them to the cart (hint: you can use
  3. list.index() function to find the index of an element of a list)
  • The cart should be implemented as a list of item titles.
  • If user chooses to see and choose based on other information than title, you should
  • find the corresponding title from the lists.
  • You need to use the item list in the template file, and implement onebuild listand
  • onecheckoutfunction. 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.

The beginning of the code is already given below:

def build_lists(items):

title_list = []

year_list = []

writer_list = []

price_list = []

#find corresponding values and append to the four lists

return title_list, year_list, writer_list, price_list

def checkout(cart, title_list, price_list):

def main():

items = ['Animal Farm, George Orwell, 1945, 19.99', 'The Great Gatsby, Scott Fitzgerald, 1934, 22.99',

'Jane Eyre, Charlotte Bronte, 1847, 27.99', 'Anna Karenina, Leo Tolstoy, 1877, 21.99 ',

'Sanctuary, William Faulkner, 1931, 30.99', 'Adventures of Huckleberry Finn, Mark Twain, 1884, 28.99']

title_list, year_list, writer_list, price_list = build_lists(items)

cart = []

print('Welcome to shopping at Amazing!')

print('We sell books from American Novelists Please choose from the following options to get information on available books')

while True:

print('Press 1 to get title of available books as a list ')

print('Press 2 to get year of publication of available books as a list ')

print('Press 3 to get writer of available books as a list ')

print('Press 4 to get price range of available books ')

# add your code here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions