Description The goal of the project is to design and implement abasic media library system in which administrators (you) caninquire the current inventory, and add or remove items. These itemsare identified either as books or movies. The media library isorganized as follows. Each entry in the library can be identifiedby its media type (Movie or Book), its Title, its Reference, andits Price. A sample media library comprised of 9 items is given inTable 1.

Reference Media Title Price TU2RL012 Movie 2001: A Space Odyssey$11.99 GV5N32M9 Book A Brief History of Time $10.17 1DB6HK3L MovieNorth by Northwest $8.99 PO5T7Y89 Movie The Good, The Bad and TheUgly $9.99 TR3FL0EW Book The Alchemist $6.99 F2O9PIE9 Book ThusSpoke Zarathustra $7.81 R399CED1 Book Jonathan Livingston Seagull$6.97 2FG6B3N9 Movie Gone with the Wind $4.99 6Y9OPL87 Book Gonewith the Wind $7.99
Table 1: A sample media library.
In addition, a book media item includes information about by itsAuthor, while a movie media item includes information about itsDirector and Lead Actor. These additional information are providedin Table 2.
Reference Author- Book Director- Movie Main Actor- Movie TU2RL012Stanley Kubrick Keir Dullea GV5N32M9 Stephen Hawking 1DB6HK3LAlfred Hitchcock Cary Grant PO5T7Y89 Sergio Leone Clint EastwoodTR3FL0EW Paulo Coelho F2O9PIE9 Friedrich Nietzsche R399CED1 RichardBach 2FG6B3N9 Victor Fleming Vivien Leigh 6Y9OPL87 MargarettMitchell
Table 2: Additional information for the sample media library.

1 The project must include three files:

1. MediaItem.py file/module that contains the user-defined type(object data) MediaItem.

2. inventory.py file/module that contains all the necessaryfunctions to operate the inventory.

3. media-store.py file containing the main program.

At the first execution of the program media-store.py, the outputincludes a menu containing 9 options:

Welcome to BestMedia ====================

Menu ====

1-List Inventory

2-Info Inventory

3-List of All Books

4-List of All Movies

5-Item Description

6-Remove Item

7-Add Item

8-Set Maximum Price

0-Exit

Enter Command:

Once option 0 (for Exit) is selected, the program stops. All theoptions will be reviewed below. The project is designed to beincremental, you can then debug, test and run your code after eachnew task/option is implemented. After Task 1 done all the otherTasks/options can be completed in any order. Do not forget tocomment your code. Make sure you obtain the exact same output forthe exact same input for the examples (this includes syntax, blankspaces, and skipping blank lines). Your program will also be testedwith different inputs by the graders.

Option-1- [30pts] Let us first see what is happening when option0 is selected. Welcome to BestMedia ==================== Menu ====1-List Inventory 2-Info Inventory 2 3-List of All Books 4-List ofAll Movies 5-Item Description 6-Remove Item 7-Add Item 8-SetMaximum Price 0-Exit Enter Command: 0 Goodbye! Let us then see whatis happening when option 1 is selected. Enter Command: 1Reference/Media/Title/Price (max=$100.0)————————— TU2RL012 Movie 2001: A Space Odyssey$11.99 GV5N32M9 Book A Brief History of Time $10.17 1DB6HK3L MovieNorth by Northwest $8.99 PO5T7Y89 Movie The Good, The Bad and TheUgly $9.99 TR3FL0EW Book The Alchemist $6.99 F2O9PIE9 Book ThusSpoke Zarathustra $7.81 R399CED1 Book Jonathan Livingston Seagull$6.97 2FG6B3N9 Movie Gone with the Wind $4.99 6Y9OPL87 Book Gonewith the Wind $7.99 Menu ==== 1-List Inventory 2-Info Inventory3-List of All Books 4-List of All Movies 5-Item Description6-Remove Item 7-Add Item 8-Set Maximum Price 0-Exit Enter Command:Here an inventory of the media store is displayed. We can see thereferences, media type, title and price of each items. The maximumprice is set to $100 meaning that all the items with a price below$100 will be listed in the inventory. At the end the menu selectionis printed again and the program is waiting for you to make anotherchoice. What you need to implement: 1. In the media store.py file:(i) The welcoming message, (2) a call to a function initialize thatwill return a list of items (data objects of typeMediaItem…explained further below), (3) a variable that keepstrack of the maximum price (initialize to $100 at first), (4) awhile loop that keeps printing the menu selection and asking theuser to enter a command choice; this while loop will exit if theentry is 0 and print a ’Goodbye!’ message; the function to printthe menu, display menu, is already provided to you in the fileinventory.py; (5) the option 1 that contains a call to a functiondisplay (you can use as arguments the list of items and the maximumprice). We note that the header of the file already 3 contains theinstruction import inventory which will allow you to call thefunctions in the inventory file using the dot operator. 2. In theMediaItem.py file: A class that define the type data objectMediaItem that includes the constructor (i.e. function init ). Youwill consider the following attributes: media, title, price, price,ref, director, lead actor, author. All the attributes can beinitialized to None by default. 3. In the Inventory.py file: (1)the initialize function that creates and returns a list ofMediaItem data objects. Ideally we would like to read all theinventory from a file (so we could easily consider 1000s of itemsif needed) but we will do that later in the semester. Here, youwill need to fill up by hand (hard coded) all the attributes of theobjects for our selected 9 items presented in Tables 1 and 2 (a bitlong but you can cc-paste title, etc. from this pdf file). (2) Thefunction display that displays the items as presented in the outputexample (you can use t to separate each field of the items). Wenote that the header of the file contains the instruction fromMediaItem import MediaItem which will allow you to use theMediaItem data type.

Option-2- [15pts]

Let us now see what is happening when option 2 is selected.Enter Command: 2 Inventory is worth $75.89 Most expensive item at$11.99 There are 5 Book(s), and 4 Movie(s) Menu ==== 1-ListInventory 2-Info Inventory 3-List of All Books 4-List of All Movies5-Item Description 6-Remove Item 7-Add Item 8-Set Maximum Price0-Exit Enter Command: The program is displaying some info about theinventory, the total value of all the media items, the price of themost expensive items, and the total number of books and moviesfound in the whole inventory. What you need to implement: 1. In themedia store.py file: the option 2 that contains a call to afunction info (you can use as arguments the list of items) 2. Inthe Inventory.py file: the function info that displays the items aspresented in the output example. You will probably needs a for loopthat scans through all members of the list of media items. To findthe maximum price you could implement the linear search algorithmseen in class.

Option-3 and 4- [10pts]

Let us now see what is happening when option 3 and then option 4are selected. 4 Enter Command: 3 Reference/Media/Title/Price(max=$100.0) ————————— GV5N32M9 Book A BriefHistory of Time $10.17 TR3FL0EW Book The Alchemist $6.99 F2O9PIE9Book Thus Spoke Zarathustra $7.81 R399CED1 Book Jonathan LivingstonSeagull $6.97 6Y9OPL87 Book Gone with the Wind $7.99 Menu ====1-List Inventory 2-Info Inventory 3-List of All Books 4-List of AllMovies 5-Item Description 6-Remove Item 7-Add Item 8-Set MaximumPrice 0-Exit Enter Command: 4 Reference/Media/Title/Price(max=$100.0) ————————— TU2RL012 Movie 2001: ASpace Odyssey $11.99 1DB6HK3L Movie North by Northwest $8.99PO5T7Y89 Movie The Good, The Bad and The Ugly $9.99 2FG6B3N9 MovieGone with the Wind $4.99 Menu ==== 1-List Inventory 2-InfoInventory 3-List of All Books 4-List of All Movies 5-ItemDescription 6-Remove Item 7-Add Item 8-Set Maximum Price 0-ExitEnter Command: This is very similar to option 1 but either themedia Book items or Movie items are displayed. In Option 3, and 4you could use the function display that would need to be modifiedto include an additional argument about the nature of themedia.

Option-5- [10pts]

Let us now see what is happening when option 5 is selected (herewe do it three times). Enter Command: 5 5 Enter item reference:1DB6HK3L Title: North by Northwest (Ref: 1DB6HK3L, Price: $8.99);Movie Director: Alfred Hitchcock; Lead Actor: Cary Grant Menu ====1-List Inventory 2-Info Inventory 3-List of All Books 4-List of AllMovies 5-Item Description 6-Remove Item 7-Add Item 8-Set MaximumPrice 0-Exit Enter Command: 5 Enter item reference: R399CED1 Title:Jonathan Livingston Seagull (Ref: R399CED1, Price: $6.97); Author:Richard Bach Menu ==== 1-List Inventory 2-Info Inventory 3-List ofAll Books 4-List of All Movies 5-Item Description 6-Remove Item7-Add Item 8-Set Maximum Price 0-Exit Enter Command: 5 Enter itemreference: ECE122ECE No such item found! Menu ==== 1-List Inventory2-Info Inventory 3-List of All Books 4-List of All Movies 5-ItemDescription 6-Remove Item 7-Add Item 8-Set Maximum Price 0-ExitEnter Command: The program is asking the user to enter a particularreference and it will display all information about this item (orreturned “No such item found!” if the item is not in theinventory). Book item will also include info about the author whileMovie item will include info about the director and lead actor.What you need to implement: 1. In the media store.py file: theoption 5 that could include a call to a function search item thatreturns the object media item if found (could return None if notfound). Another function display item 6 that displays theinformation for the selected item as presented in the outputexample. 2. In the Inventory.py file: the two functions above.

Option-6- [10pts] Let us now see what is happening when option 6is selected. Here we select option 6, follows by option 1, option 3and option 2. Enter Command: 6 Enter item reference: GV5N32M9 Menu==== 1-List Inventory 2-Info Inventory 3-List of All Books 4-Listof All Movies 5-Item Description 6-Remove Item 7-Add Item 8-SetMaximum Price 0-Exit Enter Command: 1 Reference/Media/Title/Price(max=$100.0) ————————— TU2RL012 Movie 2001: ASpace Odyssey $11.99 1DB6HK3L Movie North by Northwest $8.99PO5T7Y89 Movie The Good, The Bad and The Ugly $9.99 TR3FL0EW BookThe Alchemist $6.99 F2O9PIE9 Book Thus Spoke Zarathustra $7.81R399CED1 Book Jonathan Livingston Seagull $6.97 2FG6B3N9 Movie Gonewith the Wind $4.99 6Y9OPL87 Book Gone with the Wind $7.99 Menu==== 1-List Inventory 2-Info Inventory 3-List of All Books 4-Listof All Movies 5-Item Description 6-Remove Item 7-Add Item 8-SetMaximum Price 0-Exit Enter Command: 3 Reference/Media/Title/Price(max=$100.0) ————————— TR3FL0EW Book TheAlchemist $6.99 F2O9PIE9 Book Thus Spoke Zarathustra $7.81 R399CED1Book Jonathan Livingston Seagull $6.97 6Y9OPL87 Book Gone with theWind $7.99 7 Menu ==== 1-List Inventory 2-Info Inventory 3-List ofAll Books 4-List of All Movies 5-Item Description 6-Remove Item7-Add Item 8-Set Maximum Price 0-Exit Enter Command: 2 Inventory isworth $65.72 Most expensive item at $11.99 There are 4 Book(s), and4 Movie(s) Menu ==== 1-List Inventory 2-Info Inventory 3-List ofAll Books 4-List of All Movies 5-Item Description 6-Remove Item7-Add Item 8-Set Maximum Price 0-Exit Enter Command: The program isasking the user to enter a particular reference and thecorresponding items will be removed from the inventory as seen inthe example when you select option 1 the book “A Brief History ofTime”is not there anymore. It also disappears from the list ofbooks (since it is a book). Option 2 can return the new info aboutthe new inventory that now only contains 8 items. What you need toimplement: 1. In the media store.py file: the option 6 that couldinclude a call to a function search index item to return the indexof the item to remove from the list. We have seen in class how thebuilt-in del function can be used to then remove an item with agiven index from a list (and left shift all the other items withhigher indexes). 2. In the Inventory.py file: the method above.

Option-7- [10pts] Let us now see what is happening when option 7is selected (we use it three times here, follows by option 1 andthen 2) Enter Command: 7 Book or Movie? Book Enter Book Title:Hamlet Enter Book Reference: J45K99EE Enter Book Price: 4.59 8Enter Author Name: William Shakespeare Menu ==== 1-List Inventory2-Info Inventory 3-List of All Books 4-List of All Movies 5-ItemDescription 6-Remove Item 7-Add Item 8-Set Maximum Price 0-ExitEnter Command: 7 Book or Movie? Movie Enter Movie Title: The GreatEscape Enter Movie Reference: ER89QW43 Enter Movie Price: 7.99Enter Director Name: John Sturges Enter Lead Actor Name: SteveMcQueen Menu ==== 1-List Inventory 2-Info Inventory 3-List of AllBooks 4-List of All Movies 5-Item Description 6-Remove Item 7-AddItem 8-Set Maximum Price 0-Exit Enter Command: 7 Book or Movie?Novel Wrong input! Menu ==== 1-List Inventory 2-Info Inventory3-List of All Books 4-List of All Movies 5-Item Description6-Remove Item 7-Add Item 8-Set Maximum Price 0-Exit Enter Command:1 Reference/Media/Title/Price (max=$100.0)————————— TU2RL012 Movie 2001: A Space Odyssey$11.99 1DB6HK3L Movie North by Northwest $8.99 PO5T7Y89 Movie TheGood, The Bad and The Ugly $9.99 TR3FL0EW Book The Alchemist $6.999 F2O9PIE9 Book Thus Spoke Zarathustra $7.81 R399CED1 Book JonathanLivingston Seagull $6.97 2FG6B3N9 Movie Gone with the Wind $4.996Y9OPL87 Book Gone with the Wind $7.99 J45K99EE Book Hamlet $4.59ER89QW43 Movie The Great Escape $7.99 Menu ==== 1-List Inventory2-Info Inventory 3-List of All Books 4-List of All Movies 5-ItemDescription 6-Remove Item 7-Add Item 8-Set Maximum Price 0-ExitEnter Command: 2 Inventory is worth $78.3 Most expensive item at$11.99 There are 5 Book(s), and 5 Movie(s) Menu ==== 1-ListInventory 2-Info Inventory 3-List of All Books 4-List of All Movies5-Item Description 6-Remove Item 7-Add Item 8-Set Maximum Price0-Exit Enter Command: For option 7, once you ask the user to enterwhich media to select (Book or Movie), you will need a new functioncreate item that returns a new data object MediaItem and append itto the list (creating then a new inventory)

Option-8- [5pts]

Finally, let us now see what is happening when option 8 isselected (follow by option 1 here) Enter Command: 8 Enter maximumprice (current=$100.0): 8.0 Menu ==== 1-List Inventory 2-InfoInventory 3-List of All Books 10 4-List of All Movies 5-ItemDescription 6-Remove Item 7-Add Item 8-Set Maximum Price 0-ExitEnter Command: 1 Reference/Media/Title/Price (max=$8.0)————————— TR3FL0EW Book The Alchemist $6.99F2O9PIE9 Book Thus Spoke Zarathustra $7.81 R399CED1 Book JonathanLivingston Seagull $6.97 2FG6B3N9 Movie Gone with the Wind $4.996Y9OPL87 Book Gone with the Wind $7.99 J45K99EE Book Hamlet $4.59ER89QW43 Movie The Great Escape $7.99 Menu ==== 1-List Inventory2-Info Inventory 3-List of All Books 4-List of All Movies 5-ItemDescription 6-Remove Item 7-Add Item 8-Set Maximum Price 0-ExitEnter Command: The user is asked to enter a new maximum price.Using option 1, the inventory will not display the items that havea higher price (items are not removed, just hidden, so it will notaffect option 2, but will affect options 3 and 4).