Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Christian Ballard
- // COSC 1336 - 001
- // March 25th 2015
- // PA13 - Song Class
- #include <iostream>
- #include <iomanip>
- #include <string>
- // Include your generic files for readInt function
- #include "song.h"
- #include "genericCDB.h"
- using namespace std;
- int main()
- {
- const int NUMB_SONGS = 3;
- Song songList[NUMB_SCORES] = {
- Song("Hand In My Pocket", "Jagged Little Pill", "Alanis Morissette",
- Song::ROCK, 3, 47),
- Song("The Last Time", "Red", "Taylor Swift"), // Partially initialized Song
- }; // Note that the third song is uninitialized.
- cout << "\nSONG CLASS PROGRAM TEST CLIENT:\n";
- // Display content of songList array
- for (int i = 0; i < NUMB_SONGS; i++)
- {
- cout << "\nSong #" << i + 1 << ": " << songList[i].getSong() << endl;
- }
- int tempInt; // Variables used to store information for a new song object.
- string tempString;
- Song newSong;
- // Test set member functions
- cout << "\n\nEnter the title of a 4th new song: ";
- getline(cin, tempString);
- newSong.setTitle(tempString);
- cout << "\nWhat album is it on? ";
- getline(cin, tempString);
- newSong.setAlbum(tempString);
- cout << "\nWho is the artist? ";
- getline(cin, tempString);
- newSong.setArtist(tempString);
- cout << "\nWhat music genre is it?\n";
- cout << "\t1. Rock" << endl;
- cout << "\t2. Jazz" << endl;
- cout << "\t2. Classical" << endl;
- cout << "\t2. Blues" << endl;
- cout << "\t2. Techno" << endl;
- tempInt = readInt("Pick a genre:", 1, 5);
- newSong.setGenre(static_cast<song::MusicGenre>(tempInt));
- cout << "\nHow long is this song? " << endl;
- cout << "\nMinutes: ";
- int min = readInt("\tMinutes:", 0, 59);
- cout << "\tSeconds: ";
- int sec = readInt("\tSeconds:", 0, 59);
- newSong.setPlayingTime(min, sec);
- cout << endl << endl;
- // Test get member functions.
- cout << "The new 4th song information:\n";
- cout << "Song Title: " << newSong.getTitle() << endl;
- cout << "Album Name: " << newSong.getTitle() << endl;
- cout << "Artist Name: " << newSong.getTitle() << endl;
- cout << "Genre: " << newSong.getTitle() << endl;
- cout << "Time: " << newSong.getTitle() << endl;
- // Test isEqual member function
- cout << "\nChecking to see if class objects are equivalent.\n\n"
- << "Does the first song == the new song? "
- << boolalpha << songList[0].isEqual(newSong) << "\n";
- cout << "\nAssign the first Song to the new Song"
- << " and then check quivalency.\n\n";
- newSong = songList[0];
- cout << "Does the first song == the new song? " << songList[0].isEqual(newSong) << "\n";
- cout << "\nProgram Ended.\n";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement