Reference no: EM132330147
An inventory of the media store is displayed when option 1 is selected. We can see the references, media type, title and price of each item. At the end the menu selection is printed again and the program is waiting for you to make another choice. What you need to implement for option 1:
1. In the media_store.py file:
a) Add a call to a function initialize that will return a list of items (data objects of type Medialtem..explained further below).
b) Write a while loop that keeps printing the menu selection and asking the user to enter a command choice; this while loop will exit if the entry is 0 and print a 'Goodbye!' message; the function to print the menu, display menu, is already provided to you in the file inventory.py.
c) Add the option I that contains a call to a function display. Note that the header of the file already contains the instruction import inventory. This will allow you to call the functions in the inventory file using the dot operator.
2. In the Medialtem.py file:
a) Implement the class that defines the type data object Medialtem that includes the constructor (i.e. function _init_). You will consider the following attributes:
media, title, price, price, ref, director, lead actor, author. All the attributes can be
initialized to None by default.
3. In the inventory.py file:
a) Complete the initialize function that creates and returns a list of Medialtem data objects. Ideally we would like to read the entire inventory from a file (so we could easily consider 1000s of items if needed) but we will do that later in the semester. Here, you will need to fill up by hand (hard coded) all the attributes of the objects for our selected 9 items presented in Tables 1 and 2 (a bit long but you can cc-paste title, etc. from this pdf file).
b) Write the function display that displays the items as presented in the output example (you can use'n for line breaks and \t to separate each field of the items). We note that the header of the file contains the instruction from Medialtem import Medialtem which will allow you to use the Medialtem data type.