Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python: Part D: [25 pts] Write a class named Library. A library has the following attributes: name: the name of this library. employees: a list

Python:

Part D: [25 pts] Write a class named Library. A library has the following attributes: name: the name of this library. employees: a list of LibraryEmployees that work at the library. books: a dictionary that contains Books as keys. The value paired with each key is either an empty string, or a string representing the name of a person who has checked out the Book. The Library class should have an initializer that accepts employees and books as arguments. If provided, these values should be assigned to the objects respective attributes. If not provided, employees and books should begin as an empty list and dictionary, respectively. The value for the name attribute is always provided. The class should also have the following methods: - hire_employee(): takes in a new LibraryEmployee, and adds it to this librarys list of employees. - add_book(): takes in a new Book, and adds it to this librarys books (unless the library already has this book). If the library already has the book, print out the name of the library followed by already has this book!. - check_out_book(): takes in a Book and a persons name. If this book is in the dictionary of books, change the value at that key in the books dictionary to the persons name. Otherwise, print out Sorry, we dont have followed by the name of the book and a period. - return_book(): takes in a Book. If this book is in the dictionary of books, change the value at that key in the books dictionary to an empty string. Otherwise, print out Sorry, wrong library.. - __str__() : return the name of the library.

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

Database Systems Design Implementation And Management

Authors: Carlos Coronel, Steven Morris

14th Edition

978-0357673034

Students also viewed these Databases questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago