2. Professor C. is working on putting together a CD full of some of his favorite...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
2. Professor C. is working on putting together a CD full of some of his favorite songs, and he wants to get his money's worth by using as much space on the CD as possible. Given a list of acceptable songs to go onto the CD along with its size, write a C++ program to determine the closest to filling the CD he can get. James obviously does not want to be stuck listening to the same song twice on the CD, so he is restricted to only use each song one time. The first line of the datafile will contain a single integer n that indicates the number of data sets that follow. Each data set will begin with a time in the format "MM:SS", that will not exceed 59:59, representing the amount of song time the CD can hold, followed by a single integer m denoting the number of songs to follow. The second and final line of each test case will consist of m times in the same format as above. Output to the screen, each CD labeled, and output the largest amount of song-time that will fit on the CD without exceeding its capacity in the format "MM:SS" Let the user input the file name from the keyboard. Refer to the sample output below. Sample File: 15:00 10 01:00 02:00 03:00 04:00 05:00 06:00 05:00 03:00 02:00 01:00 59:00 6 15:00 15:00 15:00 16:00 20:00 27:00 01:00 2 2:00 1:01 Sample Run: Enter file name: cdtimes.txt CD 1: 15:00 CD 2: 58:00 CD 3: 00:00 Name the program: CDF111xx.cpp, where XX are your initials. 2. Professor C. is working on putting together a CD full of some of his favorite songs, and he wants to get his money's worth by using as much space on the CD as possible. Given a list of acceptable songs to go onto the CD along with its size, write a C++ program to determine the closest to filling the CD he can get. James obviously does not want to be stuck listening to the same song twice on the CD, so he is restricted to only use each song one time. The first line of the datafile will contain a single integer n that indicates the number of data sets that follow. Each data set will begin with a time in the format "MM:SS", that will not exceed 59:59, representing the amount of song time the CD can hold, followed by a single integer m denoting the number of songs to follow. The second and final line of each test case will consist of m times in the same format as above. Output to the screen, each CD labeled, and output the largest amount of song-time that will fit on the CD without exceeding its capacity in the format "MM:SS" Let the user input the file name from the keyboard. Refer to the sample output below. Sample File: 15:00 10 01:00 02:00 03:00 04:00 05:00 06:00 05:00 03:00 02:00 01:00 59:00 6 15:00 15:00 15:00 16:00 20:00 27:00 01:00 2 2:00 1:01 Sample Run: Enter file name: cdtimes.txt CD 1: 15:00 CD 2: 58:00 CD 3: 00:00 Name the program: CDF111xx.cpp, where XX are your initials.
Expert Answer:
Answer rating: 100% (QA)
Heres a C program to solve the problem as described include include include include include using na... View the full answer
Related Book For
Posted Date:
Students also viewed these accounting questions
-
A man comes home and he wants to open her door. He has 5 keys, two of which are the door keys but he couldn't remember them. Therefore, he tries the 5 keys independently and at random. If a key is...
-
Can I get assistance on putting together a one-page memo to support the results on explaining how these computations came together for management? Earrings Unlimited Budgeted Cash Disbursements for...
-
Elmer does not want to be abusive to his wife and wants his marriage to resume. His wife left and is staying in a shelter where she has indicated that she will not come home until Elmer gets some...
-
4. Jerry intends to use the money from his loan (and his personal savings if necessary) to make an investment in his friend Elaines business. In return, Elaine has predicted the following returns on...
-
The global economic crisis was caused by the meltdown in the U.S. housing market. Should the U.S. government bear some of the responsibility of bailing out the economies of all countries that were...
-
What would an increase in exports do to aggregate demand, other things being equal? An increase in imports? An increase in both imports and exports, where the change in exports was greater in...
-
What are your sales objectives? What extra information about Mr Forbes would be useful to have?
-
Benedetta Company makes a product that sells for $57 per unit. The company pays $25 per unit for the variable costs of the product and incurs annual fixed costs of $240,000. Benedetta expects to sell...
-
This will continue to focus on the community you have identified in Unit I, which is either the community you live or work in. It is not a fictional community and should not differ from the one...
-
Nanoparticles (3 nm in diameter) of platinum with a total weight of 1 milligram are used in automobile catalytic converters to facilitate oxidation reactions. As Pt is an expensive metal, a method to...
-
At a constant atmospheric pressure, the number of phases, P which coexist in a chosen system at equilibrium, is related to the number of components, C in the system and the degree of freedom, F by...
-
The truss shown in the figure spans a total space of 18.0 ft and carries two concentrated loads on its top chord. The members are made from standard steel angle and channel shapes as indicated in the...
-
The Northwest Flower Company owns a greenhouse, which furnishes roses and carnations to florists in Oregon, Washington, and Idaho. The greenhouse can grow any combination of the two flowers. They...
-
Statement of Advice 1 Prepare a tax return for an entity (Australian private company) (10 marks for technical and calculation accuracy and relevance and 10 marks for writing style; refer to marking...
-
The delta of a digital option that pays $1 when S(T)>K is e-T n(d2 )/[OST/2] Create an Excel worksheet in which the user input K, r, o, q and T. Compute the delta of the digital option for stock...
-
Samuel just moved to Radford and plans to live here for 5 years. He just found a "perfect" house to live in with his family. The current owner is willing to sell or rent the house to Samuel. The...
-
dictionary: 6 Sample of Execution A sample of the program execution is as follows. java WordLink WordLink A set the difficulty level B display the dictionary C insert a word to the dictionary D play...
-
If (x) 0 on the interval [a, b], the definite integral gives the exact area under the curve between x = a and x = b.
-
1. Continue the current policy that leaves it up to the Muslim workers as to when they leave the assembly line to perform their sunset rituals. 2. Try to hire the fewest possible Muslim workers so...
-
What is the glass ceiling, and why do you think it has proven to be such a barrier for women and minorities?
-
What types of IT do you as a student use on a regular basis? How might your life be different if this technology were not available to you?
-
Why is it important to decompose a system into individual components?
-
If a pattern is used to model an overly broad portion of a system, the generality of resulting pattern is sacrificed. Explain with the help of an example.
-
Explain why a pattern representing rental system will not be complete and accurate.
Study smarter with the SolutionInn App