Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Overview: The supplied data file2, music.dat and music2.dat contains a listing of the bestselling song recordings, released as singles, of all time. The assignment is

Overview: The supplied data file2, music.dat and music2.dat contains a listing of the bestselling song recordings, released as singles, of all time. The assignment is to complete two programs that will first read the song information, which includes song sales, and compute revenue and profit using additional information provided below. Each line of the data file will contain the artists name, the song name, the year released, the total sales (in millions) and medium that the song was released on. The medium will either be physical, which includes records and CDs or digital, i.e. downloads. The file format is as follows: Artist Song_Title Year Sales Medium

To simplify file parsing, multiple words in an artist name and/or song title are combined into one string with an underbar character separating each word. The programs will use this information to compute the gross revenue and the profit generated by each song using the following information. The cost to produce a song on physical media is taken to be 75 cents while the cost for a digitally released song is 25 cents. The sale prices are $1.50 for the physical media and 99 cents for downloads. (Use variables to set fixed values.) The final step will be to output a neatly formatted list of the song information, including revenue, and profit, sorted by the profit from highest to lowest.

What you need to do:

1. Prompt the user for the name of a data file o Exit gracefully if there is a problem finding or opening the data file

2. Read the information from the data file into the parallel arrays. You can assume that if the file contains data, it is well formatted. But you should: o Keep a count of the number of members read (Detect the end of the file!) o Stop reading if the number of entries in the file is greater than the array size (ignore the extra entries)

3. Output a cleanly formatted table of all data read

4. Compute the totals (revenue and profit) for each song and store them in the extra supplied arrays. Use variables to set fixed values!

5. Output all data again, but include the computed revenue and profit calculated in step 4.

6. Sort all information, including revenue and profit, for each song from high to low, based on the profit (i.e. last column).

7. Output the sorted results including all information as in step 5 (use the same output function

The output should be identical. The one, significant, difference is that this program uses an array of structs to store and process the data rather than parallel arrays

Bing_Crosby White_Christmas 1942 50 physical Elton_John Candle_in_the_Wind 1997 33 physical Mungo_Jerry In_the_Summertime 1970 30 physical Bing_Crosby Silent_Night 1935 30 physical Bill_Haley Rock_Around_the_Clock 1954 25 physical Ed_Sheeran Shape_of_You 2017 41.5 digital Luis_Fonsi Despacito 2017 36.1 digital Kesha TiK_ToK 2009 25.2 digital Ed_Sheeran Perfect 2017 21.4 digital

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

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions

Question

=+j What rules will apply to the process of negotiations?

Answered: 1 week ago