Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using python Description The goal of the project is to design and implement a basic media library system in which administrators (you) can inquire the

Using python

image text in transcribed

image text in transcribed image text in transcribedimage text in transcribed

Description The goal of the project is to design and implement a basic media library system in which administrators (you) can inquire the current inventory, and add or remove items. These items are identified either as books or movies. The media library is organized as follows. Each entry in the library can be identified by its media type (Movie or Book), its Title, its Reference, and its Price. A sample media library comprised of 9 items is given in Table 1 Reference Media TU2RL012 Movie GV5N32M9 Book DB6HK3LMovie PO5T7Y89Movie The Good, The Bad and The Ugly $9.9 TR3FLOEWBook F209PIE9 Book R399CED Book 2FG6B3N9 Movie 6Y9OPL87 Book tle 2001: A Space Odyssey A Brief History of Time North by Northwest Price $11.99 10.17 $8.99 The Alchemist Thus Spoke Zarathustra Jonathan Livingston Seagull Gone with the Wind Gone with the Wind 7.81 97 1.99 7.99 Table 1: A sample media library In addition, a book media item includes information about by its Author, while a movie media item includes information about its Director and Lead Actor. These additional information are provided in Table 2 Reference TU2RLO12 GV5N32M9 Steph IDB6HK31 PO5T7Y89 TR3FLOEW Paulo Coelho F209PIE9 Friedrich Nietzsch R399CED Richard Bach 2FG6B3N9 6Y9OPL87 Margarett Mitchell Author- Book Director- Movie Main Actor- Movie Stanley Kubrick Keir Dullea Hawking Alfred Hitchcock Cary Grant Sergio Leone Clint Eastwood ming Vivien Leigh Table 2: Additional information for the sample media library. The project must include three files: 1. MediaItem py file/module that contains the user-defined type (object data) Medialtem. 2. inventory.py file/module that contains all the necessary functions to operate the inventory 3. media-store.py file containing the main program. At the first execution of the program media-store.py, the output includes a menu containing 9 options: Welcone to BestMedia Menu 1-Liat Inventory 2-Info Inventory 3-List of A1l1 Books 4-List of All Movies 5-Item Description 6-Remove Iter 7-Add Iten 8-Set Maximum Price O-Exit Enter Command: Once option 0 (for Exit) is selected, the program stops. All the options will be reviewed below. The project is designed to be incremental, you can then debug, test and run your code after each new task/option is implemented. After Task 1 done all the other Tasks/options can be completed in any order. Do not forget to comment you examples (this includes syntax, blank spaces, and skipping blank Your program will also be tested with different inputs by the graders. r code. Make sure you obtain the exact same output for the exact same input for the Grading Proposal This project will be graded out of 100 points: 1. Your program should implement all basic functionality/Tasks and run correctly (90 points) 2. Overall programming style: program should have proper identification, and comments. (10 points) Option-1- [30pts] Let us first see what is happening when option 0 is selected. Welcone to BestMedia Menu 1-Liat Inventory 2-Info Inventory 3-List of Al1 Books 4-List of Al1 Movies 5-Iten Description 6-Remove Iten 7-Add Iten 8-Set Maximun Price O-Exit Enter Command: 0 Goodbye! Let us then see what is happening when option 1 is selected Enter Command: 1 Reference/Media/Title/Price (max-$100.0) TU2RL012 Movie 2001: A Space Odyssey $11.99 GVSN32M9 Book A Brief History of Time $10.17 1DB6HK3L Movie North by Northwest $8.99 POSTTY89 Movie The Good, The Bad and The Ugly 9.99 TRIFL0BW Book The Alchemist $6.99 F209PIE9 Book Thus Spoke Zarathustra $7.81 R399CED1 Book Jonathan Livingston Seagul1 $6.97 2FG6B3N9 Movie Gone with the Wind $4.99 6Y90PL87 Book Gone with the Wind $7.99 Menu 1-List Inventory 2-Info Inventory 3-List of A1l Books 4-List of Al1 Movies 5-Item Description 6-Remove Iten 7-Add Iten 8-Set Maximun Price o-Exit Enter Command Here an inventory of the media store is displayed. We can see the references, media type, title and price of each items. The maximum price 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 selection is printed again and the program is waiting for you to make another choice. What you need to implement 1. In the media.store.py file: (i) The welcoming message, (2) a call to a function initialize that wil return a list of items (data objects of type Medialtem...explained further below), (3) a variable that keeps track of the maximum price (initialize to $100 at first), (4) 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 (5) the option 1 that contains a call to a function display (you can use as arguments the list of items and the maximum price). We note that the header of the file already contains the instruction import inventory which will allow you to call the functions in the inventory file using the dot operator 2. In the MediaItem py file: A class that define the type data object MediaItem 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: (1) the initialize function that creates and returns a list of Medialtem data objects. Ideally we would like to read al the 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). (2) The function display that displays the items as presented in the output example (you can use t to separate each field of the items). We note that the header of the file contains the instruction from MediaItem import Medialtem which will allow you to use the Medialtem 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-List Inventory 2-Info Inventory 3-List of A11 Books 4-List of Al1 Movies 5-Iten Description 6-Remove Iter 7-Add Iten 8-Set Maximun Price O-Exit Enter Command The program is displaying some info about the inventory, the total value of all the media items, the price of the most expensive items, and the total number of books and movies found in the whole inventory What you need to implement: 1. In the media store.py file: the option 2 that contains a call to a function info (you can use as arguments the list of items) 2. In the Inventory py file: the function info that displays the items as presented in the output example. You will probably needs a for loop that scans through all members of the list of media items. To find the maximum price you could implement the linear search algorithm seen in class. Description The goal of the project is to design and implement a basic media library system in which administrators (you) can inquire the current inventory, and add or remove items. These items are identified either as books or movies. The media library is organized as follows. Each entry in the library can be identified by its media type (Movie or Book), its Title, its Reference, and its Price. A sample media library comprised of 9 items is given in Table 1 Reference Media TU2RL012 Movie GV5N32M9 Book DB6HK3LMovie PO5T7Y89Movie The Good, The Bad and The Ugly $9.9 TR3FLOEWBook F209PIE9 Book R399CED Book 2FG6B3N9 Movie 6Y9OPL87 Book tle 2001: A Space Odyssey A Brief History of Time North by Northwest Price $11.99 10.17 $8.99 The Alchemist Thus Spoke Zarathustra Jonathan Livingston Seagull Gone with the Wind Gone with the Wind 7.81 97 1.99 7.99 Table 1: A sample media library In addition, a book media item includes information about by its Author, while a movie media item includes information about its Director and Lead Actor. These additional information are provided in Table 2 Reference TU2RLO12 GV5N32M9 Steph IDB6HK31 PO5T7Y89 TR3FLOEW Paulo Coelho F209PIE9 Friedrich Nietzsch R399CED Richard Bach 2FG6B3N9 6Y9OPL87 Margarett Mitchell Author- Book Director- Movie Main Actor- Movie Stanley Kubrick Keir Dullea Hawking Alfred Hitchcock Cary Grant Sergio Leone Clint Eastwood ming Vivien Leigh Table 2: Additional information for the sample media library. The project must include three files: 1. MediaItem py file/module that contains the user-defined type (object data) Medialtem. 2. inventory.py file/module that contains all the necessary functions to operate the inventory 3. media-store.py file containing the main program. At the first execution of the program media-store.py, the output includes a menu containing 9 options: Welcone to BestMedia Menu 1-Liat Inventory 2-Info Inventory 3-List of A1l1 Books 4-List of All Movies 5-Item Description 6-Remove Iter 7-Add Iten 8-Set Maximum Price O-Exit Enter Command: Once option 0 (for Exit) is selected, the program stops. All the options will be reviewed below. The project is designed to be incremental, you can then debug, test and run your code after each new task/option is implemented. After Task 1 done all the other Tasks/options can be completed in any order. Do not forget to comment you examples (this includes syntax, blank spaces, and skipping blank Your program will also be tested with different inputs by the graders. r code. Make sure you obtain the exact same output for the exact same input for the Grading Proposal This project will be graded out of 100 points: 1. Your program should implement all basic functionality/Tasks and run correctly (90 points) 2. Overall programming style: program should have proper identification, and comments. (10 points) Option-1- [30pts] Let us first see what is happening when option 0 is selected. Welcone to BestMedia Menu 1-Liat Inventory 2-Info Inventory 3-List of Al1 Books 4-List of Al1 Movies 5-Iten Description 6-Remove Iten 7-Add Iten 8-Set Maximun Price O-Exit Enter Command: 0 Goodbye! Let us then see what is happening when option 1 is selected Enter Command: 1 Reference/Media/Title/Price (max-$100.0) TU2RL012 Movie 2001: A Space Odyssey $11.99 GVSN32M9 Book A Brief History of Time $10.17 1DB6HK3L Movie North by Northwest $8.99 POSTTY89 Movie The Good, The Bad and The Ugly 9.99 TRIFL0BW Book The Alchemist $6.99 F209PIE9 Book Thus Spoke Zarathustra $7.81 R399CED1 Book Jonathan Livingston Seagul1 $6.97 2FG6B3N9 Movie Gone with the Wind $4.99 6Y90PL87 Book Gone with the Wind $7.99 Menu 1-List Inventory 2-Info Inventory 3-List of A1l Books 4-List of Al1 Movies 5-Item Description 6-Remove Iten 7-Add Iten 8-Set Maximun Price o-Exit Enter Command Here an inventory of the media store is displayed. We can see the references, media type, title and price of each items. The maximum price 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 selection is printed again and the program is waiting for you to make another choice. What you need to implement 1. In the media.store.py file: (i) The welcoming message, (2) a call to a function initialize that wil return a list of items (data objects of type Medialtem...explained further below), (3) a variable that keeps track of the maximum price (initialize to $100 at first), (4) 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 (5) the option 1 that contains a call to a function display (you can use as arguments the list of items and the maximum price). We note that the header of the file already contains the instruction import inventory which will allow you to call the functions in the inventory file using the dot operator 2. In the MediaItem py file: A class that define the type data object MediaItem 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: (1) the initialize function that creates and returns a list of Medialtem data objects. Ideally we would like to read al the 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). (2) The function display that displays the items as presented in the output example (you can use t to separate each field of the items). We note that the header of the file contains the instruction from MediaItem import Medialtem which will allow you to use the Medialtem 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-List Inventory 2-Info Inventory 3-List of A11 Books 4-List of Al1 Movies 5-Iten Description 6-Remove Iter 7-Add Iten 8-Set Maximun Price O-Exit Enter Command The program is displaying some info about the inventory, the total value of all the media items, the price of the most expensive items, and the total number of books and movies found in the whole inventory What you need to implement: 1. In the media store.py file: the option 2 that contains a call to a function info (you can use as arguments the list of items) 2. In the Inventory py file: the function info that displays the items as presented in the output example. You will probably needs a for loop that scans through all members of the list of media items. To find the maximum price you could implement the linear search algorithm seen in class

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

More Books

Students also viewed these Databases questions