-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSong.h
56 lines (45 loc) · 1.77 KB
/
Song.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**************************************************************
* Name of the file: Song.h *
* Group 6: Ra'Caria Burgess, Janei Elliston, *
* Michael Mondelice, Michael Parrish *
* Date last edited: 4/26/2020 *
* Purpose of the class: To determine that two songs are equal*
* if they have same name and artist. *
**************************************************************/
#ifndef SONG_H
#define SONG_H
#include <iostream>
#include <string>
#include <fstream>
// Song is a simple class that stores a title and artist as strings
// it just provides i/o operators, == operator, constructors and Set function
class Song
{
public:
// output the song in the format:
// title, artist, album, year, length
// output to console
friend std::ostream& operator<<(std::ostream& os, const Song& song);
//output to file
friend std::ofstream& operator<<(std::ofstream& os, const Song& song);
// input the song in the format:
// title, artist, album, year, length
friend std::istream& operator>>(std::istream& is, Song& song);
//input from file
friend std::fstream& operator>>(std::fstream& is, Song& song);
// compare two song objects for equality
friend bool operator==(const Song& lhs, const Song& rhs);
// constructors
Song( );
Song(std::string title, std::string artist, std::string album, int year, int length);
Song(std::string title, std::string artist);
// set the song
void set(std::string title, std::string artist, std::string album, int year, int length);
private:
int year;
int length; //lenth is stored in # of seconds
std::string title;
std::string artist;
std::string album;
};
#endif