- This event has passed.
5 PM – Python OOP – Bill
April 3, 2023 @ 5:00 pm - 6:00 pm
Your HW:
- Create a new file in the src folder called “book.py”
- Create a book class with the following attributes:
- Title
- Author
- Year
- ID
- Create a new file in the src folder called “main.py”
- Inside the main.py create a new class called BookSystem like the SchoolSystem class
- Give it a menu attribute and a book_dictionary attribute
- Make it have a main_loop method that continuously asks the user for options to a menu
- Make an add_a_book method
- Make a list_all_books method
- So your program should have the 1. Add book and 2. List all books features working like below. You do not need to do the remaining features in the menu (#3, #4, #5)
-
Please look at below options 1. Add book 2. List all books 3. Find book by Title 4. Find book by id 5. List all old books Enter your selection. Enter 'quit' to exit: 1 ADD NEW BOOK Enter book title: Narnia Enter book author: CS Lewis Enter publish year: 1960 Enter book id: ABC1 You have added Narnia book to our library. Please look at below options 1. Add book 2. List all books 3. Find book by Title 4. Find book by id 5. List all old books Enter your selection. Enter 'quit' to exit: 1 ADD NEW BOOK Enter book title: Hobit Enter book author: JRR Tolkien Enter publish year: 1963 Enter book id: ABC2 You have added Hobit book to our library. Please look at below options 1. Add book 2. List all books 3. Find book by Title 4. Find book by id 5. List all old books Enter your selection. Enter 'quit' to exit: 2 LIST ALL BOOKS Narnia [ABC1] by CS Lewis - 1960 Hobit [ABC2] by JRR Tolkien - 1963 Please look at below options 1. Add book 2. List all books 3. Find book by Title 4. Find book by id 5. List all old books Enter your selection. Enter 'quit' to exit: