(Solved) : Using Functions Cstrings Structs Build Menu Driven Program Media Collection Won T Working Q43964497 . . .
You will be using functions, Cstrings and structs to build amenu driven program for a media collection. We won’t be workingwith File IO in this project.
What To Code
Write a menu-driven program for a user to store informationabout the media collection they own. This requires using an arrayof struct type called Media. Every element in the array representsone media item in a person’s collection. Represent the informationas an array of structs that needs to able to hold up to 100 mediaentries. However, the actual number of entries is probably muchsmaller so the program needs to keep track of how many actualentries are in the collection.
A Media struct
Each media item has an unique ID, category, title, year and adescription. The title and description wont be any larger than 250characters so you can make C-strings of that size. You must useC-strings for these fields; so string type allowed. Year and IDnumber are integers. Acceptable category values would be ‘video’,’printed’ and ‘audio’ and any other media categories you might wantto add. NOTE: although not a requirement, the category can be madeinto an enum type but you can also just use a set of C-strings aswell.
User Actions
The user should be able to do the following:
• Add a media item to the collection – Ask the user for theinformation. Make sure the category is a valid value and that theyear is not negative. You can either set the ID to an unique numberOR you can let the user type in an ID but make sure the user typesin an ID that’s unique.
• Print all media in the collection – Keep in mind that thisshould not print any blank entries in your array. • Print all mediain a given category – Print out all entries with the givencategory. Shouldn’t print any other entries from othercategories.
• Delete an entry – Ask for an ID number (you can print out thelist for the user). Then delete this entry from the array. NOTE:The best way to do this is to move entries over one. Another way,which is more complex, is to put a ‘marker’ value in one of thefields (ID or title) to indicate that this entry is deleted andthen skip over this entry when searching and printing.
Functions
You need to use functions in this project. They should be calledat some point in your code and should do something useful. Keep inmind that all functions, including main, must be less than 30 lineslong. “Lines” means any line of actual code so it excludes blanklines, lines with only braces and comment lines.
HINT: The above list of tasks should all be inside functions.Reading in from the file and writing out to the file should also beinside functions. You might also want to make a printEntry functionthat takes an index into the array and prints out all the mediainformation at that index. This can be used in several differentfunctions. Also, a findEntry might also be useful: takes a mediaID, searches for it and returns the index of where the ID was found(pass back a -1 if the ID is not found). This can be used in addingthe entry to verify that the ID is not in the list (is unique).
Requirements
The tasks as listed above should be available for the userchoose and should work as described. You can add other tasks andfeatures but I will be only grading you on the above tasks so makesure these work before you add other things. You must create anduse a Media struct; other structs are optional. You must haveenough functions in your program to keep all of them under 30 lineslong. Again, all functions should be called at some point in yourprogram and do some work. All functions, including main, must beless than 30 lines long (this count does not include comments,blank lines and { } on separate lines). You need to use C-strings,no ‘string’ type in your entire code. You can keep constants at theglobal level but no variables are allowed to be global. So pass thecollection array and entry count into functions along with anyother variables. If you need to change a variable, please rememberto pass it in by reference ( put ‘&’ in front of parametername). There should be one and only one array in your file; youwill get points off if you have any other arrays in your file ORare missing an array.
NOTE: It might be easier to do debugging if you put a fewentries into the array ahead of time so you don’t have to keeptyping them in for testing your program. You can also leave them inbut I should be able to add or delete to the array when I gradeyour project.
Expert Answer
Answer to You will be using functions, Cstrings and structs to build a menu driven program for a media collection. We won’t be w…
OR