Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

An incomplete template for the program is supplied in the location specified above. The supplied template contains a main routine that defines a set of

An incomplete template for the program is supplied in the location specified above. The supplied template contains a main routine that defines a set of parallel arrays to hold and process band member data. In addition, a static variable sets the array sizes which limits the number of members that can be processed do not change this value. 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).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

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

#include #include #include using namespace std;

// prototypes int readDatafile(string[], string[], int[], float[], string[], int); void outputData(string[], string[], int[], float[], string[], int); void calcTotals(/* ... */); void outputResults(/* ... */);

// add prototypes and functions as needed for sorting

main() { static int ARRAYSIZE= 10; string names[ARRAYSIZE]; // song names string artists[ARRAYSIZE]; // artist names int year[ARRAYSIZE]; // year of release float sales[ARRAYSIZE]; // sales string medium[ARRAYSIZE]; // medium ID float gross[ARRAYSIZE]; // gross revenue float profit[ARRAYSIZE]; // profit

}

// open and read the datafile int readDatafile(string artist[], string name[], int year[], float sales[], string medium[], int max) { string fname; ifstream ifs }

int num=0;

}

// output the data! void outputData(string artist[], string name[], int year[], float sales[], string medium[], int max) { cout

--------------------------------------------------------------------

data file to be read**********************

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

----------------------------------------------------------------------------------------

Output should look in the photo.image text in transcribed

Song Sales data: Bing Crosby Elton John Mungo_Jerry Bing Crosby Bill Haley Ed Sheeran Luis Fonsi Kesha Ed Sheeran white_christmas Candle_inthe_wind In the_Summertime Silent_Night Rock_Around the clock Shape_of_You Despacito TiK_TOK Perfect 1942 1997 1970 1935 1954 2017 2017 2009 2017 50.00 physical 33.00 physical 30.00 physical 30.00 physical 25.00 physical 41.50 digital 36.10 digital 25.20 digital 21.40 digital Member Totals: - - - - Bing Crosby Elton John Mungo_Jerry Bing Crosby Bill Haley Ed Sheeran Luis_Fonsi Kesha Ed Sheeran white_christmas Candle_in_the_wind In_the_Summertime Silent_Night Rock_Around_the_clock Shape_of_You Despacito TiK_TOK Perfect 1942 1997 1970 1935 1954 2017 2017 2009 2017 50.00 physical 75.00 37.50 33.00 physical 49.50 24.75 30.00 physical 45.00 22.50 30.00 physical 45.00 22.50 25.00 physical 37.50 18.75 41.50 digital 41.08 30.71 36.10 digital 35.74 26.71 25.20 digital 24.95 18.65 21.40 digital 21.19 15.84 Member Totals: ----- -- - - - Bing Crosby Ed_Sheeran Luis_Fonsi Elton John Mungo_Jerry Bing_Crosby Bill Haley Kesha Ed Sheeran white_christmas Shape_of_You Despacito Candle_in_the_wind In_the_Summertime Silent Night Rock__Around the clock TiK_TOK Perfect 1942 2017 2017 1997 1970 1935 1954 2009 2017 50.00 physical 75.00 37.50 41.50 digital 41.08 30.71 36.10 digital 35.74 26.71 33.00 physical 49.50 24.75 30.00 physical 45.00 22.50 30.00 physical 45.00 22.50 25.00 physical 37.50 18.75 25.20 digital 24.95 18.65 21.40 digital 21.19 15.84 Song Sales data: Bing Crosby Elton John Mungo_Jerry Bing Crosby Bill Haley Ed Sheeran Luis Fonsi Kesha Ed Sheeran white_christmas Candle_inthe_wind In the_Summertime Silent_Night Rock_Around the clock Shape_of_You Despacito TiK_TOK Perfect 1942 1997 1970 1935 1954 2017 2017 2009 2017 50.00 physical 33.00 physical 30.00 physical 30.00 physical 25.00 physical 41.50 digital 36.10 digital 25.20 digital 21.40 digital Member Totals: - - - - Bing Crosby Elton John Mungo_Jerry Bing Crosby Bill Haley Ed Sheeran Luis_Fonsi Kesha Ed Sheeran white_christmas Candle_in_the_wind In_the_Summertime Silent_Night Rock_Around_the_clock Shape_of_You Despacito TiK_TOK Perfect 1942 1997 1970 1935 1954 2017 2017 2009 2017 50.00 physical 75.00 37.50 33.00 physical 49.50 24.75 30.00 physical 45.00 22.50 30.00 physical 45.00 22.50 25.00 physical 37.50 18.75 41.50 digital 41.08 30.71 36.10 digital 35.74 26.71 25.20 digital 24.95 18.65 21.40 digital 21.19 15.84 Member Totals: ----- -- - - - Bing Crosby Ed_Sheeran Luis_Fonsi Elton John Mungo_Jerry Bing_Crosby Bill Haley Kesha Ed Sheeran white_christmas Shape_of_You Despacito Candle_in_the_wind In_the_Summertime Silent Night Rock__Around the clock TiK_TOK Perfect 1942 2017 2017 1997 1970 1935 1954 2009 2017 50.00 physical 75.00 37.50 41.50 digital 41.08 30.71 36.10 digital 35.74 26.71 33.00 physical 49.50 24.75 30.00 physical 45.00 22.50 30.00 physical 45.00 22.50 25.00 physical 37.50 18.75 25.20 digital 24.95 18.65 21.40 digital 21.19 15.84

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions

Question

5-8 What are the advantages and disadvantages of the BYOD movement?

Answered: 1 week ago