-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmovie.cpp
More file actions
40 lines (32 loc) · 1.02 KB
/
movie.cpp
File metadata and controls
40 lines (32 loc) · 1.02 KB
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
#include <sstream>
#include <iostream>
#include <algorithm>
#include "movie.h"
#include "util.h"
Movie::Movie(const std::string category, const std::string name, double price, int qty, const std::string genre, const std::string rating) :
Product(category, name, price, qty), genre_(genre), rating_(rating) {
}
Movie::~Movie() {
}
std::set<std::string> Movie::keywords() const {
std::set<std::string> keywords = parseStringToWords(name_);
keywords.insert(convToLower(genre_));
return keywords;
}
std::string Movie::displayString() const {
std::stringstream ss;
ss << name_ << std::endl;
ss << "Genre: " << genre_ << " Rating: " << rating_ << std::endl;
ss << price_ << " " << qty_ << " left.";
return ss.str();
}
void Movie::dump(std::ostream& os) const {
os << category_ << "\n" << name_ << "\n" << price_ << "\n" << qty_
<< "\n" << genre_ << "\n" << rating_ << std::endl;
}
std::string Movie::getGenre() const {
return genre_;
}
std::string Movie::getRating() const {
return rating_;
}