American Young Coder Academy – Indo

Loading Events

« All Events

  • This event has passed.

5 PM – Python OOP – Bill

April 3, 2023 @ 5:00 pm - 6:00 pm

Your HW:
  1. Create a new file in the src folder called “book.py”
  2. Create a book class with the following attributes:
    1. Title
    2. Author
    3. Year
    4. ID
  3. Create a new file in the src folder called “main.py”
  4. Inside the main.py create a new class called BookSystem like the SchoolSystem class
    1. Give it a menu attribute and a book_dictionary attribute
    2. Make it have a main_loop method that continuously asks the user for options to a menu
  5. Make an add_a_book method
  6. Make a list_all_books method
  7. 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)
  8. 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:

Details

Date:
April 3, 2023
Time:
5:00 pm - 6:00 pm
Verified by MonsterInsights