Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a python program for managing media check-out/check-in with members (i.e. a library) There are two types of Media objects - books and videos: Books

Create a python program for managing media check-out/check-in with members (i.e. a library) There are two types of Media objects - books and videos:

Books have title, author, publisher, and number of pages.

Videos have title, author, publisher, and running time.

There is a Members object:

Members have name, and can CheckOut and CheckIn books and videos.

If a book or a video is already checked out, then it cannot be checked out again, until it is

checked back in.

Store a list of checked out items for a member and create a method to display it.

To provide general information about the media and members:

Keep track of how many books and videos are in the library and how many are checked out

Keep track of how many members are there. Requirements:

You are to create object oriented code and keep all attributes within the objects.

Your code is to use demonstrate the concept of inheritance, method overriding.

You are to implement the "__repr__ method for print" so that you can print the contents

of an object.

Names used for attributes and methods are to be meaningful and easy to understand.

Display a confirmation message during check-out/check-in, showing the name of the

member and the information of the media.

A member shall only be allowed to check out 2 items at once.

Hints:

Media is a superclass of books and videos - there is no need to create a library class.

All common attributes and methods should be placed in the superclass.

Anything specific to the subclasses should be stored and implemented with the

subclasses.

Consider what information should be stored in instance attributes and what in class

attributes.

Members is a standalone class for keeping information about the member.

o You need to implement methods to enable the member to interact with books and videos by passing the instance object as argument (refer to class example.)

- Follow good programming practices and make sure that your code includes plenty of comments. - Refrain from reusing the same name for attributes/variables throughout the code for different purposes as this will get confusing and makes the code hard to read.

To test your code, you must:

Create instances of books, videos, and members.

Call the CheckOut and CheckIn methods on each member.

Call the PrintCheckOutItems method to display all items checked out by a member.

Call the CheckOut method on a book/video that is already checked out by another

member and verify that a message is displayed the book/video is already checked out

by ...

Call the DisplayStats method to display records of

o the total number of books, and books checked out o the total number of videos, and videos checked out o the total number of members

Below an example for reference, you can create more test cases as needed.

book1

=Book( ... ) # creates an instance for a book book2=Book( ... ) # creates an instance for a book Joe=Members("Joe Smith") # creates an instance for a member Jim.Members("Jim Stuart")# creates an instance for a member Joe.CheckOut( ... ) video1=Video( ... ) Joe.CheckOut( ... ) Jim.CheckOut( ... ) # this should attempt to checkout the same one as Joe did

Joe.CheckIn( ... ) Joe.PrintCheckedOutItems() displayStats()

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_2

Step: 3

blur-text-image_3

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 Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

KEY QUESTION Refer to columns 1 and 6 in the table for question

Answered: 1 week ago