Question
This program uses structures and functions. The Problem Statement You and your roommate are combining your DVD collections. What you'd like to do is see
This program uses structures and functions. The Problem Statement You and your roommate are combining your DVD collections. What you'd like to do is see which DVD's you have duplicate copies of, and then sell the extra copies on eBay, splitting the proceeds equally. To automate the process of determining how much money you expect to make, you decide to write a computer program. Program Setup A scaffold of the solution has been created for you: dvd-scaffold.cPreview the documentView in a new window Do not modify the code that is already present. Instead, fill in the getProfit function marked like this: /*** ... ***/ This function takes in two arrays of DVDs (representing your roommates' DVDs and your DVDs, respectively), the lengths of both arrays, and returns the sum of the sale prices of all the DVDs in both collections with the identical titles. If both of you share a DVD with the same title but different sale prices (the 7th edition always costs more than the 6th), assume that you'll sell the more expensive copy and keep the cheaper one, in an effort to maximize your return. Function Prototype You must use this prototype to receive credit for the assignment. // Pre-condition: list1 is an array of length len1, list2 is an array // of length len2. No title appears in either list more // than once. // Post-condition: Returns the sum of the sale prices of the common // DVDs in both lists. Two DVDs are considered the // same if their titles are identical. double getProfit(DVD* list1, int len1, DVD* list2, int len2); Sample Run dvd.inView in a new window dvd.outView in a new window Specification Homework assignments are either correct or incorrect. Do not modify any of the printf statements in the scaffold. Do not add any printf statements to the program. Submission Test your program for correctness. Make sure you code is easy to read and that you include a header comment and comments throughout your function(s). Finally, attach your .c source file to this assignment and submit it.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started