Answered step by step
Verified Expert Solution
Question
1 Approved Answer
* * I need this section answered using the answered section below * * For part 2 , you will turn in an outline of
I need this section answered using the answered section below
For part you will turn in an outline of your program. This means you will turn in a program that runs, but does not have all of the functionality of a working program. Use comments, function definitions, and the reserved word pass to create a program that runs but does not have actual functionality yet.
For example, this is a function definition that has been defined but not implemented yet:
def getBookPricebookID:
This function takes the bookID as a parameter and returns the price of the book to the user
pass
The keyword pass is used by Python to allow the program to run without errors but also to define it later during implementation. You may use pass for many things, for example for functions, for if statements, for loops. Of course, if you are ready you may implement them as well!
For this program outline you should have: your functions named and commented, your overall structure, modules you might import, your function calls in main, lists you might use, and so on The outline should be organized into sections and commented enough so that it is understandable to me how you will eventually write the program.
This section is answered
For your final project, you will create an online shopping cart for a Book Store.
The program should display a menu option to let the user do the following:
Display a list of books available for sale
Add to the list of books available
Delete from the list of books available
Buy a book from the list by adding the book into a cart
Show items in the cart
Checkout
Quit the program
Be sure to properly comment your code throughout the entire program!
A book should have a title, author, genre, and price. I would recommend using a tuple to store this information about a book.
An inventory should have a collection of books for sale. Create a map dictionary called books to implement the collection.
The key should be item number as string and the value should be a Book tuple.
Your program should have an "addbook" function to add books into its inventory.
The function should read a list of books from a file called booklisttxt The text file might look like this:
Science: A Visual Encyclopedia,Chris Woodford,Science,
My First Human Body Book,Patricia J Wynne and Donald M Silver,Science,
The Runaway Children,Sandy Taylor,Fiction,
The Tuscan Child,Rhys Bowen,Fiction,
Learning Python,Mark Lutz,Programming,
Each line in the file is a book information separated by comma Each piece of information in a line is called a field or column.
Fields in the lines are item number, title, author, genre, and the price.
The program should also have a function called display to show all the books available for sale.
Like the Inventory, the Cart should have a list or collection of books bought by the user.
Unlike Inventory, Cart should not read from the file to add books into its collection. It should get the book from the user input to make its book list.
The program should also have a function checkout to show the list of books and the total price of the books bought by the user.
The checkout method function also print a message to thank the user for hisher business.
When you run the program, your program should display a menu similar to the one below:
Display Books
Add to inventory
Delete from inventory
Add to Cart
Show Cart
Checkout
Quit
Select an option:
When the user presses the program should display the list of books from the inventory. Option asks the user for the item to add to inventory. It should update the text file.
Option asks the user for the item number to delete from inventory. It should also update the text file.
When the user presses the program should ask for the item number the user wants to buy. When the user enters the item number, the program should add the inventory item into the cart.
Option should display the list of books in the shopping cart. If there is no item in the cart, a message should be displayed saying Your cart is empty.
Option should display the total amount of purchased books in the cart. If there is no item in the cart, a message should be displayed saying Your cart is empty.
Finally, option should quit the program. When the user quits the program, the program should display a thank you for shopping message to the user. Make sure to write proper comments in your program to document your code.
If you would like, your store can sell something other than books. But each item in inventory should have multiple properties.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started