PlayList.h x + > PlayList > f add_song 1 #ifndef PLAY_LIST_H 2 #define PLAY_LIST_H 3 #include using namespace std; 4 5 6 class PlayList { 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #endif }; private: string songs [50]; //to store the titles of songs unsigned nSongs_; //number of songs in the play list public: //constructors PlayList(); //Accessors string first() const; string last() const; string random() const; void display(const string& keyword //mutator void add_song (const string&); void remove_song(const string&); = "") const; E : C playlist.cpp x + > f last 1 #include 2 #include 3 #include "PlayList.h" 4 using namespace std; LO 5 6 //default constructor 7▼ PlayList::PlayList() { 8 this-> nSongs_ = 0; 9 10 11 void PlayList::display(const string& keyword) const { 12 13 14 } 15 16 string PlayList::first() const { 17 string firstsong; 18 19 return firstsong; 20 } 21 22 string PlayList::last() const { 23 string lastsong; 24 25 return lastsong; 26 } } [19] :

Oh no! Our experts couldn't answer your question.

Don't worry! We won't leave you hanging. Plus, we're giving you back one question for the inconvenience.

Submit your question and receive a step-by-step explanation from our experts in as fast as 30 minutes.
You have no more questions left.
Message from our expert:
Our experts need more information to provide you with a solution. Please resubmit your question, making sure it's detailed and complete. We've credited a question to your account.
Your Question:

Please help I need to make 2 functions that display the first and last string of the songs[] array.... but I am confused because I am getting errors when I attempt writing the function body.

I want to also make an add_song function which will take a string as its parameter, representing the title of a song to be added to the invoking PlayList

If the title already exists in the songs_ array, the function shall not update nSongs_ or songs_.

If the title does not exist in the songs_ array, the function shall add the title to the songs_ array and increase the value of nSongs_ by one. I dont want to call the add_song function when the songs_ array is at its capacity.

PlayList.h x +
> PlayList > f add_song
1 #ifndef PLAY_LIST_H
2 #define PLAY_LIST_H
3 #include <string>
using namespace std;
4
5
6 class PlayList {
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #endif
};
private:
string songs [50]; //to store the titles of songs
unsigned nSongs_; //number of songs in the play list
public:
//constructors
PlayList();
//Accessors
string first() const;
string last() const;
string random() const;
void display(const string& keyword
//mutator
void add_song (const string&);
void remove_song(const string&);
= "") const;
E
Transcribed Image Text:PlayList.h x + > PlayList > f add_song 1 #ifndef PLAY_LIST_H 2 #define PLAY_LIST_H 3 #include <string> using namespace std; 4 5 6 class PlayList { 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #endif }; private: string songs [50]; //to store the titles of songs unsigned nSongs_; //number of songs in the play list public: //constructors PlayList(); //Accessors string first() const; string last() const; string random() const; void display(const string& keyword //mutator void add_song (const string&); void remove_song(const string&); = "") const; E
:
C playlist.cpp x +
> f last
1 #include <iostream>
2 #include <iomanip>
3 #include "PlayList.h"
4 using namespace std;
LO
5
6 //default constructor
7▼ PlayList::PlayList() {
8 this-> nSongs_ = 0;
9
10
11 void PlayList::display(const string& keyword) const {
12
13
14 }
15
16 string PlayList::first() const {
17 string firstsong;
18
19 return firstsong;
20 }
21
22 string PlayList::last() const {
23
string lastsong;
24
25 return lastsong;
26 }
}
[19]
:
Transcribed Image Text:: C playlist.cpp x + > f last 1 #include <iostream> 2 #include <iomanip> 3 #include "PlayList.h" 4 using namespace std; LO 5 6 //default constructor 7▼ PlayList::PlayList() { 8 this-> nSongs_ = 0; 9 10 11 void PlayList::display(const string& keyword) const { 12 13 14 } 15 16 string PlayList::first() const { 17 string firstsong; 18 19 return firstsong; 20 } 21 22 string PlayList::last() const { 23 string lastsong; 24 25 return lastsong; 26 } } [19] :
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY