-
Notifications
You must be signed in to change notification settings - Fork 0
/
Movie.cpp
75 lines (56 loc) · 1.24 KB
/
Movie.cpp
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "Movie.h"
#include <iostream>
#include <cctype>
using namespace std;
Movie & Movie::operator=(const Movie & other){
this->title = other.getTitle();
this->keyWords = other.getAllKeywords();
return *this;
}
bool Movie::operator==(const Movie & other){
if(this->title == other.getTitle() && this->keyWords == other.getAllKeywords()){
return true;
} else {
return false;
}
}
Movie::Movie(){
this->title = "noTitle";
}
Movie::Movie (string title){
this->title = title;
}
Movie::Movie (const Movie & other){
this->title = other.getTitle();
this->keyWords = other.getAllKeywords();
}
Movie::~Movie (){
//automatic destructor
}
string Movie::getTitle () const {
return title;
}
void Movie::addKeyword (string keyword){
bool exists = false;
exists = (keyWords.find(keyword) != keyWords.end());
if(exists == false){
keyWords.insert(keyword);
}
}
const Set<string> & Movie::getAllKeywords () const{
return keyWords;
}
void Movie::addActor(std::string actor){
if(actors.find(actor) == actors.end()){
actors.insert(actor);
}
}
const Set<string> & Movie::getAllActors () const{
return actors;
}
void Movie::setCost(double num){
rentalCost = num;
}
double Movie::getCost(){
return rentalCost;
}