-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmovie.cpp
More file actions
42 lines (33 loc) · 1004 Bytes
/
movie.cpp
File metadata and controls
42 lines (33 loc) · 1004 Bytes
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
#include "product.h"
#include "util.h"
#include <sstream>
#include "movie.h"
using namespace std;
Movie::Movie(string genre, string rating, string category, string name, double price, int qty):Product(category, name, price, qty){
genre_=genre;
rating_=rating;
}
Movie::~Movie(){
}
//creates set of keywords associated with a product
std::set<std::string> Movie::keywords() const{
std::set<std::string> set1=parseStringToWords(name_);
std::set<std::string> set2=parseStringToWords(genre_);
std::set<std::string> set3=setUnion(set1, set2);
return set3;
}
//formats product information
string Movie::displayString() const{
ostringstream oss;
oss<<name_<<endl<<"Genre: "<<genre_<<" "<<"Rating: "<<rating_<<endl<<price_<<" "<<qty_<<" left."<<endl;
return oss.str();
}
//for writing information to output file
void Movie::dump(ostream& os) const{
os<<category_<<endl;
os<<name_<<endl;
os<<price_<<endl;
os<<qty_<<endl;
os<<genre_<<endl;
os<<rating_<<endl;
}