1) Class creation
Create a class called Song. It will contain the following private attributes:
The song title.
The artist who performs the song
The duration of the song in terms of seconds. A song that lasts 3 minutes and 30 seconds will hold a value of 210.
Create a program that does nothing but instantiates the class.
Compile and fix errors.
2) Constructor Implementation
Declare and Implement a no-arg (default) constructor for this class. The constructor should assign a value of -99 to the duration attribute.
Declare and implement a getter (accessor) for the duration member.
3) Test that the constructor works properly.
After instantiating the class, output the result of the return value from the getter.
So, your main() code should look something like this:
cout << "The length of the song is:" << mySong.getDuration() << endl;
What value do you expect to see from this output?
4) What's wrong (if anything) with the following code?
cout << "The title of the song is:" << mySong.title << endl;
5) Create another constructor
Create a second 3-arg constructor that will accept the title of the song, the name of the song's artist, and the duration as arguments. Implement this constructor so that these values are assigned to the correct members.
6) Create getters for the other two members.
7) Test the 3-argument constructor in a way similar to step 3.
8) Create several (at least 2) instances of real-life songs, using the 3-arg constructor (take a guess at the duration if you don't know).
9) Create an array of 3 Songs.
Which of the 2 constructors is run for each Song instance in this case? HINT: You can always test this by putting some debugging output in the constructors.