Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON 3 PROGRAM Assignment (NOTE: Must use Procedural Programming - NOT object-oriented) Description The goal of the project is to design and implement a basic

PYTHON 3 PROGRAM Assignment (NOTE: Must use Procedural Programming - NOT object-oriented) image text in transcribed image text in transcribed image text in transcribed image 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 DB6HK3L Movie PO5T7Y89Movie The Good, The Bad and The UglyS9.99 Title 2001: A Space Odyssey A Brief History of Time North by Northwest Price 11.99 10.17 TR3FLOEW|Book F209PIE9 Book R399CED1 Book 2FG6B3N9Movie 6Y9OPL87 Book The Alchemist Thus Spoke Zarathustra Jonathan Livingston Seagull Gone with the Wind Gone with the Wind .99 $7.81 $6.97 $4.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 Author- Book Reference TU2RL012 GV5N32M9Stephen Hawking DB6HK3L PO5T7Y89 TR3FLOEW Paulo Coelho F209PIE9 Friedrich Nietzsche R399CED1 Richard Bach 2FG6B3N9 6Y9OPL87 Margarett Mitchell Director- Movie Main Actor- Movie Stanley KubrickKeir Dullea Alfred Hitchcock Cary Grant Sergio Leone Clint Eastwood Victor Fleming 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: Welcome to BestMedia Menu 1-List Inventory 2-Info Inventory 3-List of All Books 4-List of Al1 Movies 5-Item Description 6-Remove Item 7-Add Item 8-Set Maximum Price -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 lines). 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 his 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 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: 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 GV5N32M9 Book A Brief History of Time $10.17 1DB6HK3L Movie North by Northwest $8.99 PO5T7Y89 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 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 All Books 4-List of All Movies 5-Item Description 6-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 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 mediastore.py file: (i) The welcoming message, (2) a call to a function initialize that will 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 a 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 ce-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 Medialtem import Medialtem which will allow you to use the Medialtem data type 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 DB6HK3L Movie PO5T7Y89Movie The Good, The Bad and The UglyS9.99 Title 2001: A Space Odyssey A Brief History of Time North by Northwest Price 11.99 10.17 TR3FLOEW|Book F209PIE9 Book R399CED1 Book 2FG6B3N9Movie 6Y9OPL87 Book The Alchemist Thus Spoke Zarathustra Jonathan Livingston Seagull Gone with the Wind Gone with the Wind .99 $7.81 $6.97 $4.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 Author- Book Reference TU2RL012 GV5N32M9Stephen Hawking DB6HK3L PO5T7Y89 TR3FLOEW Paulo Coelho F209PIE9 Friedrich Nietzsche R399CED1 Richard Bach 2FG6B3N9 6Y9OPL87 Margarett Mitchell Director- Movie Main Actor- Movie Stanley KubrickKeir Dullea Alfred Hitchcock Cary Grant Sergio Leone Clint Eastwood Victor Fleming 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: Welcome to BestMedia Menu 1-List Inventory 2-Info Inventory 3-List of All Books 4-List of Al1 Movies 5-Item Description 6-Remove Item 7-Add Item 8-Set Maximum Price -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 lines). 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 his 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 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: 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 GV5N32M9 Book A Brief History of Time $10.17 1DB6HK3L Movie North by Northwest $8.99 PO5T7Y89 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 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 All Books 4-List of All Movies 5-Item Description 6-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 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 mediastore.py file: (i) The welcoming message, (2) a call to a function initialize that will 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 a 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 ce-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 Medialtem import Medialtem which will allow you to use the Medialtem data type

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

Step: 3

blur-text-image

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

Question

8. Explain the relationship between communication and context.

Answered: 1 week ago