Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

CD playlist

I have no idea where to start on this. Any tips would be great. Thanks.
/*Overloaded Operator Worksheet 1 =>> 20 points

For this worksheet, I would like you to turn in a compiler screen shot, a source listing that will resolve the following programming
assignment and the additional requested screen shots.You have just been hired by Napster.com. They would like you to create a C++ program
that will allow their customers to download songs, customized to fit a standard burnable CD. They have a classes outline as follows:

class song
{
char Name[20]; // Name of the song
char Artist[20]; // Name of the artist
int TimeLengthOfTrack; // How many seconds the song is
float DownLoadTime; // Average time to download
int StorageSizeOfTrack; // Number of bytes the track takes up
public:
....
}

class CD
{
int NumberOfTracks; // Number of songs on the CD
int AmountOfStorageUsed; // Total storage used
int AmountOfStorageAvail; // Total storage remaining
char NameOfSong[20][20]; // Name of the song on each track
char NameOfArtist[20][20]; // Name of the song on each track
float DownLoadTimeForCD; // Total download time for all tracks on CD
public:
.....
}
I would like you to create and array of 20 song instances. I would like the user to select the instances they would like on the CD.
You will need to overload the += operator for the CD class so that it will add all of the selected tracks from the array of songs.
You must meet the following requirements:
- Must not be larger than 650M in total storage used
- Must not contain more than 10 songs
- Must not have a download time of greater than 45 minutes
Considerations:
a. Create member functions / constructors as needed
b. Include error checking for the above requirements
c. Include a screen shot of several different song array elements that have data in them
d. Include a screen shot listing the contents of you cd, lising the track number, the song for that track, the artist, and the size (in bytes)
for that track.*/
#include <iostream>
using namespace std;
///////////////////////////////////////////////////////////////////
class song
{
private:
char Name[20]; // Name of the song
char Artist[20]; // Name of the artist
int TimeLengthOfTrack; // How many seconds the song is
float DownLoadTime; // Average time to download
int StorageSizeOfTrack; // Number of bytes the track takes up
public:

};
//////////////////////////////////////////////////////////////
class CD
{
private:
int NumberOfTracks; // Number of songs on the CD
int AmountOfStorageUsed; // Total storage used
int AmountOfStorageAvail; // Total storage remaining
char NameOfSong[20][20]; // Name of the song on each track
char NameOfArtist[20][20]; // Name of the song on each track
float DownLoadTimeForCD; // Total download time for all tracks on CD
public:

};
/////////////////////////////////////////////////////////////
int main()
{
CD cd1;
song song1;
}
[3240 byte] By [krazykrisi] at [2007-11-11 10:20:41]
# 1 Re: CD playlist
OK, please post specific questions since we're not usually doing people's homework here. What have you got so far? Which part are you trying to implement?
Danny at 2007-11-11 20:59:04 >
# 2 Re: CD playlist
Here is what I have so far. He said to hard code all the information so then the user can choose which songs they want to put on the cd. I'm stuck with the second class, I don't know what to do with it.
/*Overloaded Operator Worksheet 1 =>> 20 points

For this worksheet, I would like you to turn in a compiler screen shot, a source listing that will resolve the following programming
assignment and the additional requested screen shots.You have just been hired by Napster.com. They would like you to create a C++ program
that will allow their customers to download songs, customized to fit a standard burnable CD. They have a classes outline as follows:

class song
{
char Name[20]; // Name of the song
char Artist[20]; // Name of the artist
int TimeLengthOfTrack; // How many seconds the song is
float DownLoadTime; // Average time to download
int StorageSizeOfTrack; // Number of bytes the track takes up
public:
....
}

class CD
{
int NumberOfTracks; // Number of songs on the CD
int AmountOfStorageUsed; // Total storage used
int AmountOfStorageAvail; // Total storage remaining
char NameOfSong[20][20]; // Name of the song on each track
char NameOfArtist[20][20]; // Name of the song on each track
float DownLoadTimeForCD; // Total download time for all tracks on CD
public:
.....
}
I would like you to create and array of 20 song instances. I would like the user to select the instances they would like on the CD.
You will need to overload the += operator for the CD class so that it will add all of the selected tracks from the array of songs.
You must meet the following requirements:
- Must not be larger than 650M in total storage used
- Must not contain more than 10 songs
- Must not have a download time of greater than 45 minutes
Considerations:
a. Create member functions / constructors as needed
b. Include error checking for the above requirements
c. Include a screen shot of several different song array elements that have data in them
d. Include a screen shot listing the contents of you cd, lising the track number, the song for that track, the artist, and the size (in bytes)
for that track.*/
#include <iostream>
using namespace std;
///////////////////////////////////////////////////////////////////
class song
{
private:
char Name[20]; // Name of the song
char Artist[20]; // Name of the artist
int TimeLengthOfTrack; // How many seconds the song is
float DownLoadTime; // Average time to download
float StorageSizeOfTrack; // Number of bytes the track takes up
public:
song() : Name[0], Artist[0], TimeLengthOfTrack(0), DownLoadTime(0.0), StorageSizeOfTrack(0) //constructor
{ }
void setNameOfTrack()
{
//initialize each element of array Name
Name[0] = "Dear Angel";
Name[1] = "Independently Happy";
Name[2] = "The No Seatbelt Song";
Name[3] = "Lips Of An Angel";
Name[4] = "Crawling";
Name[5] = "I Don't Know";
Name[6] = "Rock Star";
Name[7] = "Trashed and Scattered";
Name[8] = "Suspension";
Name[9] = "Scars";
Name[10] = "Move Along";
Name[11] = "Such Great Heights";
Name[12] = "Calling You";
Name[13] = "Faith";
Name[14] = "Chapter Four";
Name[15] = "Alright";
Name[16] = "All Star";
Name[17] = "Crazy Mary";
Name[18] = "Living On A Prayer";
Name[19] = "Smooth Criminal";

for(int x=0; x != 20; x++)
{
cout << Name[x]; //display track names
} //end for
}
void setArtist()
{
//initialize each element of array Artist
Artist[0] = "April Sixth";
Artist[1] = "Blue October";
Artist[2] = "Brand New";
Artist[3] = "Hinder";
Artist[4] = "Linkin Park";
Artist[5] = "Lostprophets";
Artist[6] = "Nickelback";
Artist[7] = "Avenged Sevenfold";
Artist[8] = "Mae";
Artist[9] = "Papa Roach";
Artist[10] = "All-American Rejects";
Artist[11] = "The Postal Service";
Artist[12] = "Blue October";
Artist[13] = "George Michael";
Artist[14] = "Avenged Sevenfold";
Artist[15] = "Casting Pearls";
Artist[16] = "Smash Mouth";
Artist[17] = "FM Static";
Artist[18] = "Bon Jovi";
Artist[19] = "Alien Ant Farm";

for(int x=0; x != 20; x++)
{
cout << Artist[x]; //display artists
} //end for
}
void setTimeLength()
{
for(int x=0; x <= 20; x++)
{ //initialize and display time of each track
switch(Name[x])
{
case 1: cout << TimeLengthOfTrack = 252;//
break;
case 2: cout << TimeLengthOfTrack = 294;
break;
case 3: cout << TimeLengthOfTrack = 269;/
break;
case 4: cout << TimeLengthOfTrack = 261;/
break;
case 5: cout << TimeLengthOfTrack = 208;//
break;
case 6: cout << TimeLengthOfTrack = 237;//
break;
case 7: cout << TimeLengthOfTrack = 255;//
break;
case 8: cout << TimeLengthOfTrack = 353;
break;
case 9: cout << TimeLengthOfTrack = 230;//
break;
case 10: cout << TimeLengthOfTrack = 208;//
break;
case 11: cout << TimeLengthOfTrack = 240;//
break;
case 12: cout << TimeLengthOfTrack = 266;//
break;
case 13: cout << TimeLengthOfTrack = 239;//
break;
case 14: cout << TimeLengthOfTrack = 253;//
break;
case 15: cout << TimeLengthOfTrack = 342;//
break;
case 16: cout << TimeLengthOfTrack = 208;//
break;
case 17: cout << TimeLengthOfTrack = 203;//
break;
case 18: TimeLengthOfTrack = 168;//
break;
case 19: cout << TimeLengthOfTrack = 250;//
break;
case 20: cout << TimeLengthOfTrack = 208;//
break;
} //end switch
} //end for
} //end member function
void setDownloadTime()
{
for(int x=0; x<=20; x++)
{
switch(TimeLengthOfTrack)
{
case 168: cout << DownLoadTime = 1.00 << " minute";
break;
case 203: cout << DownLoadTime = 1.90 << " minutes";
break;
case 208: cout << DownLoadTime = 2.00 << " minutes";
break;
case 230: cout << DownLoadTime = 2.30 << " minutes";
break;
case 237: cout << DownLoadTime = 2.37 << " minutes";
break;
case 239: cout << DownLoadTime = 2.39 << " minutes";
break;
case 240: cout << DownLoadTime = 2.40 << " minutes";
break;
case 242: cout << DownLoadTime = 2.42 << " minutes";
break;
case 250: cout << DownLoadTime = 2.50 << " minutes";
break;
case 252: cout << DownLoadTime = 2.52 << " minutes";
break;
case 253: cout << DownLoadTime = 2.53 << " minutes";
break;
case 255: cout << DownLoadTime = 2.55 << " minutes";
break;
case 261: cout << DownLoadTime = 3.01 << " minutes";
break;
case 266: cout << DownLoadTime = 3.06 << " minutes";
break;
case 269: cout << DownLoadTime = 3.09 << " minutes";
break;
case 294: cout << DownLoadTime = 3.34 << " minutes";
break;
case 353: cout << DownLoadTime = 4.03 << " minutes";
break;
} //end switch
} //end for
} //end membe function
void setStorage()
{
for(int x=0; x != 20; x++)
{
switch(Name[x])
{
case 0: cout << StorageSizeOfTrack = 3.94 << "MB";
break;
case 1: cout << StorageSizeOfTrack = 5.64 << "MB";
break;
case 2: cout << StorageSizeOfTrack = 4.17 << "MB";
break;
case 3: cout << StorageSizeOfTrack = 6.93 << "MB";
break;
case 4: cout << StorageSizeOfTrack = 4.80 << "MB";
break;
case 5: cout << StorageSizeOfTrack = 3.64 << "MB";
break;
case 6: cout << StorageSizeOfTrack = 3.96 << "MB";
break;
case 7 : cout << StorageSizeOfTrack = 5.39 << "MB";
break;
case 8: cout << StorageSizeOfTrack = 6.53 << "MB";
break;
case 9: cout << StorageSizeOfTrack = 4.79 << "MB";
break;
case 10: cout << StorageSizeOfTrack = 3.70 << "MB";
break;
case 11: cout << StorageSizeOfTrack = 4.11 << "MB";
break;
case 12: cout << StorageSizeOfTrack = 5.50 << "MB";
break;
case 13: cout << StorageSizeOfTrack = 3.01 << "MB";
break;
case 14: cout << StorageSizeOfTrack = 5.23 << "MB";
break;
case 15: cout << StorageSizeOfTrack = 4.76 << "MB";
break;
case 16: cout << StorageSizeOfTrack = 4.67 << "MB";
break;
case 17: cout << StorageSizeOfTrack = 2.56 << "MB";
break;
case 18: cout << StorageSizeOfTrack = 3.81 << "MB";
break;
case 19: cout << StorageSizeOfTrack = 4.78 << "MB";
break;
} //end switch
} //end for
} //end member function
}; //end class
//////////////////////////////////////////////////////////////
class CD
{
private:
int NumberOfTracks; // Number of songs on the CD
int AmountOfStorageUsed; // Total storage used
int AmountOfStorageAvail; // Total storage remaining
char NameOfSong[20][20]; // Name of the song on each track
char NameOfArtist[20][20]; // Name of the song on each track
float DownLoadTimeForCD; // Total download time for all tracks on CD
public:
CD(): NumberOfTracks(0), AmountOfStorageUsed(0), AmountOfStorageAvail(650), NameOfSong[0][0], NameOfArtist[0][0], DownLoadTimeForCD(0.0) //constructor
{ }
int getNumOfTracks()
{
cout << "How many tracks would you like on this CD? ";
cin >> NumberOfTracks;
}


};
/////////////////////////////////////////////////////////////
int main()
{

}
krazykrisi at 2007-11-11 21:00:10 >