Question: /** * This is the main/driver program for the student created * SongInfo class. Your class should implement the necessary * methods and fields to

/** * This is the main/driver program for the student created * "SongInfo" class. Your class should implement the necessary * methods and fields to make the following code work without issues. * * You should not change this program in anyway, your class should * adjust to make this work. */ #include #include #include "SongInfo.h"

using namespace std;

int main() { SongInfo myPlayList[10]; // These five work like normal. myPlayList[0] = SongInfo("16 Tons", 1987, 2.75); myPlayList[1] = SongInfo("Beautiful Day", 2000, 4.1215); myPlayList[2] = SongInfo("Axel F", 1984, 4.65); myPlayList[3] = SongInfo("Christmas in Sarajevo", 1996, 3.41); myPlayList[4] = SongInfo("Bring Me to Life", 2003,3.95);

// This one has an invalid year myPlayList[5] = SongInfo("The Gambler", 1981, -4.5);

// Invalid time myPlayList[6] = SongInfo("What a wonderful World", -1947, 2.26);

// 2 parameter Constructor myPlayList[7] = SongInfo("If I could turn back time",1989);

// 1 parameter Constructor myPlayList[8] = SongInfo("In the Air Tonight");

// 0 parameter Constructor myPlayList[9] = SongInfo();

// Print out the song data. // Note that it only prints out data that is valid. for(int i = 0; i < 10 ; i++) { myPlayList[i].printSong(); }

// Find the total time. double totalTime = 0; for(SongInfo x : myPlayList) { totalTime += x.getTime(); }

cout << endl << endl << "The total known time of the play list is " << setprecision(1) << fixed << totalTime << " minutes." << endl; }

  • Then using it a guide, write the "SongInfo" class files. (h/cpp) that make the file work.
  • Upload your two files.
  • The output should be as close to the output as seen below.
    • You might need to use iomanip to get the details right.
    • You will need to eyeball scan the main program to see what methods/constructors you need.
    • You will need at least 2 different constructors.

Song-16 Tons : recorded in year 1987: length- 2.75 minutes Song-Beautiful Day : recorded in year 2000: length- 4.12 minutes Song-Axel F : recorded in year 1984: length- 4.65 minutes Song-Christmas in Sarajevo : recorded in year 1996: length- 3.41 minutes Song-Bring Me to Life : recorded in year 2003: length- 3.95 minutes Song-The Gambler : recorded in year 1981 Song-What a wonderful World : length- 2.26 minutes Song-If I could turn back time : recorded in year 1989 Song-In the Air Tonight Song-Unknown The total known time of the play list is 21.1 minutes.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!