In python
The goal of the project is to design and implement a basic media library system in which administrators (you) ean inquire the current inventory, and add or remove iteus. These items are identified either as book or smovies. 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 iteas is given in Table L. $11.99 Talble 1: A sasple media library In addition, a book media item includes information about by its Author, while a movie media iten inchudes ladoemation ahout its Direetor and Load Actoe. Tse additional information are provkled in Table 2 500005555 The project must include three files: I. Mediatten.py fle/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. sedia-store.py Bile containing the main peogram. At the first exscution of the program nedia-store.py, the output includes a menu containing 9 options Velcome to Best Media Manu 1-List Inventory 2-Inte Inventory 3-List of AL1 Books 4-List ot A11 Novies s-Ites Descript.ion 7-kld Iten -Set Maxin Pzice O-Exit Ester Conmand Once option O (for Exit) is selected, the program stope. All the options wilt be reviewed below. The peoject is designed to be incremental, you can then debug, test and run your code after each new task/option is implessented. After Thk1 done all the other Theks/options cn be coipleted in any order. Do not forget to coment your code. Make sure you obtain the exact same out put for the exact same input for the esamples (his lacbule ayudass, blank spaces, and skipping blank ne), Your progrsan will aleo be tested with differed inputs by the graders Grading Proposal This project will be graded out of 100 pnd d ran eotrveetly (30 pointa) 2 Overal Option130pts] hy delets Welcome to BestMedia Menu 1-List Inventory 2-Info Inventory 3-List of All Books 4-List of A11 Novies 5-Iten Description 6-Remove Iten 7-Add Ites 8-Set Maxius Price 0-Exit Enter Connand: 0 Coodbye! Let us then see what is happening when option 1 is selected. Enter Connand: Retarence/Hedia/Title/Pria. Char-too.o) TUZRLOLS Movie 2001: &Space odyssey 911.99 i30aaD1 Book )onst han Livingston Saagan 6.37 Mavie Cone vith ly 1-Liat Inventory 2-Iato Inrentory 3-List of 131 Books 4-List of A11 Movies s-Ites Deacription 6-Renove Ites 7-kdd Ites 8-Set Haxinus Price -Exit Ester Conmand Here an inventory of the isedia store is displayed. We can see the references, media type, tite and price of each items The maxinam price is set to $100 meaning that all the items with a price bekow $100 will be listed in the inventory. At the end the menu selection is pristed again and the program is waiting for you to make another choice. What you need to implement: 1. In the nedia.atore.py file:(1) The welcoming messuge, (2) a call to a function initialize that will return a list of items (data objects of type Medialtes...xplained further below), (3) a variable that keeps track of the maximun price (initialise to $100 at irst) (4) a while loop that keeps peinting the menu selection and asking the usee to ecter a comsuand choice; this while loop will ecit if the entry is O and prist aGoodbye" mseage the function to print the meni diaplay.zens, is already peovided to you in the file inveatory.py: (5) the option 1 that costains a call to a function display tyou ca use " arguments the list of items and the-saximum price), wo note that the beader of the Sie already isventary which will allow you to call the functious in the iavestory hy 144 P-11 //&7 11.8 11(9 ll)o ll.. Il+. Ilh 3. In the Taventory.py file: (1) the initialize function that creates and returas a list of Medialtsi data objects. Ideally we would lke to read all 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 I and 2 (a bit long but you can er-paste title, etc. from this pdf file). (2) The function display that displays the items as presented in the out put example (you can use \t to separate each field of the items). We note that the header of the file contains the instruction from Medialten import Medialten which will allow you to use the Medialtem data type. Option-2- [15pts Let now icc vbath happening when cptioo2 selected. Eater Comnand: 2 lsvestory is vorth $76.9 Roat expenaive ites at $3.9 Thare are 5 Bocko), and 4 Moriea) 1-List toventory 2-Isto Isvenn a-Liss of Al1 Books s-Ites Descesption -341 Maxieun Price The peogram in displaying wne indo about the Investory, the total value of all the media itens, the prie What you seed to implement I. Io the sediastore.py Sle the option 2 thet contains a call tobusction info tvou can w Option-3 and 4- (10pts) ry 9 Enter Connand: 3 Reference/Hedia/Title/Price (naz $100.0) CVSN32M9 Book A Brief History of Tine $10.17 TR3PLOEW Book The Alchemist $6.99 F209PIE9 Book Thus Spoke Zarathustra $7.81 R399CED1 Book Jonathan Livingston Seagull $6.97 Y9OPLST Book Gone vith the Wind $7.99 Mena 1-List Inventory 2-Into Inventory 3-List of All Books 4-List of A11 Movies S-Ites Description 6-Resove Item 7-ldd Ites 8-Set Maximun Price O-Exit Enter Conmand: 4 Reterence/Media/Title/Price x-$100.0) TUZRLO12 Movie 2001:A Space Odyssey $11.99 IDBeHK3L Movie North by Northwest $8.99 POSTTYE9 Novie The Good, The Bad and The Ugly 89.99 2P068389 Hovie Gone with the Vind $4.99 3-List ot 11 Boks 7-164 hyp 0000000 00 00 y 5555055500NI ISEG-KRY 00 Enter Command: 6 Enter iten reference: R399CED Title: Jonathan Livingston Seagull CRef: R399CED1,Price:6.97) uthor: Richard Bach 1-List Inventory 2-Info Inventory 3-List of AL3 Books 4-Liat of All Mories 5-Iten Description 6-Renove Iten -id4 Ites 8-Set Man Price o-Exit Eater Comnand:5 Eater itan reference : ECE22tX to wuch ites tound 1-List inventory a-Into Inventory 3-List ot ALL Books 4-Liss ot s-Iven Deacriptton this iten (or eeturned No uch ite So if the item is not in ndo alont the wothor while Movie iten wil inclade info about What you need to implement the dieretor Ana bul ker. None i wa nd) Anothes urtion dixplay.item prt sc backsp Enter Conmand: The program is asking the user to enter a particular reference and the correspoading items will be removed from the inventory as seen in the example when you select option 1 the book "A Brief History of Time"is not there anymore. It also disappears from the list of books (since it is a book). Option 2 can return the new info about the new inventory that now only contains 8 items What you need to implement 1. In the nedia.atore.py file: the option 6 that could include a call to a function search.index.iten to retura the index of the item to remove from the list. We have seen in class how the built-in del function can be used to then remove an item with a given index from a list (and left shift all the other items with higher indexes). 2. In the Inventory.py file: the method above. Option-7-(10pts] Let us now see what is lappening when option 7 is selected (ae use it three times bere, follows by option 1 and then 2) Enter Book Titia: Mlet Bock Refecsnce: 345839 Enter Book Price: 4.59 hyp Enter Author Name: William Shakespeare 1-List Inventory 2-Into Inventory 3-List of All Books 4-List of All Movies 5-Item Description 6-Remove Item 7-Add Item 8-Set Maximun Price 0-Exit Enter Command: 7 Book or Hovie? Movie Enter Movie Title: The Great Escape Enter Movie Reference: ER890W43 Enter Movie Price: 7.99 Enter Director Nane: John Sturges Enter Lead Actor Name: Steve McQueen 1-List Inventory 2-Into Inventory 3-List of Al1 Books 4-List of A1l Hovies 7-Add Iten 8-Sat Haxinun Price o-Exit Eater Conmand: 7 Vrong Lnput Enter Comnand: 1 Reference/Media/Title/Price (ax-$100.0) TU2RL012 Movie 2001: A Space Odyssey $11.99 1DBGHK3L Movie North by Northvest $8.99 POSTTY89 Movie The Good, The Bad and The Ugly $9.99 TR3FLOEW Book The Alchemist $6.99 F209PIE9 Book Thus Spoke Zarathustra $7.81 R399CED1 Book Jonathan Livingston Seagull $6.97 2PC6B3N9 Movie Gone with the Wind $4.99 6Y90PL87 Book Gone vith the Wind $7.99 345K99EE Book Hanlet $4.59 ERB90V43 Movie The Great Escape $7.99 Mens 1-List Inventory 2-Info IaventoEy 3-List of A11 Books 4-List of A11 Movies 5-Iten Description 6-Resove Item 7-Add 1ten 8-Set Maxinus Price o-Exit Enter Connand: 2 Isventory la worth $78.3 Thers are 5 BookCa). and 5 Hovie) Menis 2-Tato Inventory Enter Conmand: 2 Inventory is worth $78.3 Host expensive item at $11.99 There are 5 Book (a), and 5 Movie(o) Menu 1-Liat Inventory 2-Info Inventory 3-Liat of A11 Books 4-List of Al1 Novies 5-Ites Deacription 6-Remore Iten 7-kdd Iten 8-Set Maxinun Price -Exit Enter Connand For option 7, once you ask the user to enter which media to select (Book or Movie), you will need a new function create.item that returus a sew data object Medialten and append it to the list (creating them a new inventory) Option-&-[Spts Finally, let us now M, what . happening when option 8 "slected (Allow by option,here) Eater ssri.. price (eurreat.00.0) : 8.0 s-List lavestery 3-List ot A13 Books 10 144 ort sc 4-List of A11 Movies 5-Iten Description 6-Remove Iten 7-Add Iten 8-Set Maxinus Price o-Exit Enter Comnand:1 Reference/Media/Title/Price (max-$8.0) TRSFLOEN Book The Alchemist $6.99 F209PIE9 Book Thus Spoke Zarathustra $7.81 R399CED1 Book Josathan Livisgston Seagu11 36.97 ZFC6BM9 Hovi. Gone with the wind 4.99 YSOPL87 Book Gone with the Wind $7.99 45K99EE Book Hanlet $4.59 DB9043 Movie The Great Escape $7.99 1-List Inventory a-Into Iarentory 3-List of A11 Books 4-List ot Al2 Movies 6-Iten Description 6-Renove Ten r-kdd Iten Enter Command: The user io awked to endee s ew onximum peice, Using option 1, the investory will not display the i tlust have a higher price (itesms are not removed, jest hidden, o it will aot affect option 2. bet will affect options 3 and 4). 0 No The goal of the project is to design and implement a basic media library system in which administrators (you) ean inquire the current inventory, and add or remove iteus. These items are identified either as book or smovies. 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 iteas is given in Table L. $11.99 Talble 1: A sasple media library In addition, a book media item includes information about by its Author, while a movie media iten inchudes ladoemation ahout its Direetor and Load Actoe. Tse additional information are provkled in Table 2 500005555 The project must include three files: I. Mediatten.py fle/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. sedia-store.py Bile containing the main peogram. At the first exscution of the program nedia-store.py, the output includes a menu containing 9 options Velcome to Best Media Manu 1-List Inventory 2-Inte Inventory 3-List of AL1 Books 4-List ot A11 Novies s-Ites Descript.ion 7-kld Iten -Set Maxin Pzice O-Exit Ester Conmand Once option O (for Exit) is selected, the program stope. All the options wilt be reviewed below. The peoject is designed to be incremental, you can then debug, test and run your code after each new task/option is implessented. After Thk1 done all the other Theks/options cn be coipleted in any order. Do not forget to coment your code. Make sure you obtain the exact same out put for the exact same input for the esamples (his lacbule ayudass, blank spaces, and skipping blank ne), Your progrsan will aleo be tested with differed inputs by the graders Grading Proposal This project will be graded out of 100 pnd d ran eotrveetly (30 pointa) 2 Overal Option130pts] hy delets Welcome to BestMedia Menu 1-List Inventory 2-Info Inventory 3-List of All Books 4-List of A11 Novies 5-Iten Description 6-Remove Iten 7-Add Ites 8-Set Maxius Price 0-Exit Enter Connand: 0 Coodbye! Let us then see what is happening when option 1 is selected. Enter Connand: Retarence/Hedia/Title/Pria. Char-too.o) TUZRLOLS Movie 2001: &Space odyssey 911.99 i30aaD1 Book )onst han Livingston Saagan 6.37 Mavie Cone vith ly 1-Liat Inventory 2-Iato Inrentory 3-List of 131 Books 4-List of A11 Movies s-Ites Deacription 6-Renove Ites 7-kdd Ites 8-Set Haxinus Price -Exit Ester Conmand Here an inventory of the isedia store is displayed. We can see the references, media type, tite and price of each items The maxinam price is set to $100 meaning that all the items with a price bekow $100 will be listed in the inventory. At the end the menu selection is pristed again and the program is waiting for you to make another choice. What you need to implement: 1. In the nedia.atore.py file:(1) The welcoming messuge, (2) a call to a function initialize that will return a list of items (data objects of type Medialtes...xplained further below), (3) a variable that keeps track of the maximun price (initialise to $100 at irst) (4) a while loop that keeps peinting the menu selection and asking the usee to ecter a comsuand choice; this while loop will ecit if the entry is O and prist aGoodbye" mseage the function to print the meni diaplay.zens, is already peovided to you in the file inveatory.py: (5) the option 1 that costains a call to a function display tyou ca use " arguments the list of items and the-saximum price), wo note that the beader of the Sie already isventary which will allow you to call the functious in the iavestory hy 144 P-11 //&7 11.8 11(9 ll)o ll.. Il+. Ilh 3. In the Taventory.py file: (1) the initialize function that creates and returas a list of Medialtsi data objects. Ideally we would lke to read all 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 I and 2 (a bit long but you can er-paste title, etc. from this pdf file). (2) The function display that displays the items as presented in the out put example (you can use \t to separate each field of the items). We note that the header of the file contains the instruction from Medialten import Medialten which will allow you to use the Medialtem data type. Option-2- [15pts Let now icc vbath happening when cptioo2 selected. Eater Comnand: 2 lsvestory is vorth $76.9 Roat expenaive ites at $3.9 Thare are 5 Bocko), and 4 Moriea) 1-List toventory 2-Isto Isvenn a-Liss of Al1 Books s-Ites Descesption -341 Maxieun Price The peogram in displaying wne indo about the Investory, the total value of all the media itens, the prie What you seed to implement I. Io the sediastore.py Sle the option 2 thet contains a call tobusction info tvou can w Option-3 and 4- (10pts) ry 9 Enter Connand: 3 Reference/Hedia/Title/Price (naz $100.0) CVSN32M9 Book A Brief History of Tine $10.17 TR3PLOEW Book The Alchemist $6.99 F209PIE9 Book Thus Spoke Zarathustra $7.81 R399CED1 Book Jonathan Livingston Seagull $6.97 Y9OPLST Book Gone vith the Wind $7.99 Mena 1-List Inventory 2-Into Inventory 3-List of All Books 4-List of A11 Movies S-Ites Description 6-Resove Item 7-ldd Ites 8-Set Maximun Price O-Exit Enter Conmand: 4 Reterence/Media/Title/Price x-$100.0) TUZRLO12 Movie 2001:A Space Odyssey $11.99 IDBeHK3L Movie North by Northwest $8.99 POSTTYE9 Novie The Good, The Bad and The Ugly 89.99 2P068389 Hovie Gone with the Vind $4.99 3-List ot 11 Boks 7-164 hyp 0000000 00 00 y 5555055500NI ISEG-KRY 00 Enter Command: 6 Enter iten reference: R399CED Title: Jonathan Livingston Seagull CRef: R399CED1,Price:6.97) uthor: Richard Bach 1-List Inventory 2-Info Inventory 3-List of AL3 Books 4-Liat of All Mories 5-Iten Description 6-Renove Iten -id4 Ites 8-Set Man Price o-Exit Eater Comnand:5 Eater itan reference : ECE22tX to wuch ites tound 1-List inventory a-Into Inventory 3-List ot ALL Books 4-Liss ot s-Iven Deacriptton this iten (or eeturned No uch ite So if the item is not in ndo alont the wothor while Movie iten wil inclade info about What you need to implement the dieretor Ana bul ker. None i wa nd) Anothes urtion dixplay.item prt sc backsp Enter Conmand: The program is asking the user to enter a particular reference and the correspoading items will be removed from the inventory as seen in the example when you select option 1 the book "A Brief History of Time"is not there anymore. It also disappears from the list of books (since it is a book). Option 2 can return the new info about the new inventory that now only contains 8 items What you need to implement 1. In the nedia.atore.py file: the option 6 that could include a call to a function search.index.iten to retura the index of the item to remove from the list. We have seen in class how the built-in del function can be used to then remove an item with a given index from a list (and left shift all the other items with higher indexes). 2. In the Inventory.py file: the method above. Option-7-(10pts] Let us now see what is lappening when option 7 is selected (ae use it three times bere, follows by option 1 and then 2) Enter Book Titia: Mlet Bock Refecsnce: 345839 Enter Book Price: 4.59 hyp Enter Author Name: William Shakespeare 1-List Inventory 2-Into Inventory 3-List of All Books 4-List of All Movies 5-Item Description 6-Remove Item 7-Add Item 8-Set Maximun Price 0-Exit Enter Command: 7 Book or Hovie? Movie Enter Movie Title: The Great Escape Enter Movie Reference: ER890W43 Enter Movie Price: 7.99 Enter Director Nane: John Sturges Enter Lead Actor Name: Steve McQueen 1-List Inventory 2-Into Inventory 3-List of Al1 Books 4-List of A1l Hovies 7-Add Iten 8-Sat Haxinun Price o-Exit Eater Conmand: 7 Vrong Lnput Enter Comnand: 1 Reference/Media/Title/Price (ax-$100.0) TU2RL012 Movie 2001: A Space Odyssey $11.99 1DBGHK3L Movie North by Northvest $8.99 POSTTY89 Movie The Good, The Bad and The Ugly $9.99 TR3FLOEW Book The Alchemist $6.99 F209PIE9 Book Thus Spoke Zarathustra $7.81 R399CED1 Book Jonathan Livingston Seagull $6.97 2PC6B3N9 Movie Gone with the Wind $4.99 6Y90PL87 Book Gone vith the Wind $7.99 345K99EE Book Hanlet $4.59 ERB90V43 Movie The Great Escape $7.99 Mens 1-List Inventory 2-Info IaventoEy 3-List of A11 Books 4-List of A11 Movies 5-Iten Description 6-Resove Item 7-Add 1ten 8-Set Maxinus Price o-Exit Enter Connand: 2 Isventory la worth $78.3 Thers are 5 BookCa). and 5 Hovie) Menis 2-Tato Inventory Enter Conmand: 2 Inventory is worth $78.3 Host expensive item at $11.99 There are 5 Book (a), and 5 Movie(o) Menu 1-Liat Inventory 2-Info Inventory 3-Liat of A11 Books 4-List of Al1 Novies 5-Ites Deacription 6-Remore Iten 7-kdd Iten 8-Set Maxinun Price -Exit Enter Connand For option 7, once you ask the user to enter which media to select (Book or Movie), you will need a new function create.item that returus a sew data object Medialten and append it to the list (creating them a new inventory) Option-&-[Spts Finally, let us now M, what . happening when option 8 "slected (Allow by option,here) Eater ssri.. price (eurreat.00.0) : 8.0 s-List lavestery 3-List ot A13 Books 10 144 ort sc 4-List of A11 Movies 5-Iten Description 6-Remove Iten 7-Add Iten 8-Set Maxinus Price o-Exit Enter Comnand:1 Reference/Media/Title/Price (max-$8.0) TRSFLOEN Book The Alchemist $6.99 F209PIE9 Book Thus Spoke Zarathustra $7.81 R399CED1 Book Josathan Livisgston Seagu11 36.97 ZFC6BM9 Hovi. Gone with the wind 4.99 YSOPL87 Book Gone with the Wind $7.99 45K99EE Book Hanlet $4.59 DB9043 Movie The Great Escape $7.99 1-List Inventory a-Into Iarentory 3-List of A11 Books 4-List ot Al2 Movies 6-Iten Description 6-Renove Ten r-kdd Iten Enter Command: The user io awked to endee s ew onximum peice, Using option 1, the investory will not display the i tlust have a higher price (itesms are not removed, jest hidden, o it will aot affect option 2. bet will affect options 3 and 4). 0 No