-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMovie.h
158 lines (124 loc) · 3 KB
/
Movie.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#pragma once
#pragma once
#include <string>
#include <iostream>
#include <limits>
using namespace std;
class Movie {
public:
/*Constructors*/
Movie(); //When movie is empty
Movie(string, string, string, int); //Special Constructor
Movie createMovie();
void printMovie(Movie);
/*Getters*/
string getTitle()const;
string getSynopsis()const;
string getDirector()const;
int getRYear()const;
/*Setters*/
void setTitle(string);
void setSynopsis(string);
void setDirector(string);
void setRYear(int);
bool movieExist()const;
private:
string title;
string synopsis;
string director;
int ryear;
};
/*Empty Movie*/
Movie::Movie() {
title = synopsis = director = ryear = 0;
}
/*Special Constructor*/
Movie::Movie(string t, string s, string d, int r) {
title = t;
synopsis = s;
director = d;
ryear = r;
}
/*GetTitle Function*/
string Movie::getTitle()const{
return title;
}
/*GetSynopsis Function*/
string Movie::getSynopsis()const{
return synopsis;
}
/*GetDirector Function*/
string Movie::getDirector()const{
return director;
}
/*GetRYear Function*/
int Movie::getRYear()const{
return ryear;
}
/*SetTitle Function*/
void Movie::setTitle(string t) {
title = t;
}
/*SetSynopsis Function*/
void Movie::setSynopsis(string s) {
synopsis = s;
}
/*SetDirector Function*/
void Movie::setDirector(string d) {
director = d;
}
/*SetRYear Function*/
void Movie::setRYear(int r) {
ryear = r;
}
bool Movie::movieExist()const {
return !title.empty();
}
/*
* Funcion createMovie
*
* Funcion se encarga de crear la pelicula
*
*/
Movie Movie::createMovie() {
Movie userMovie;
cout << "\t\tCreating a New Movie\n"
<< "----------------------------------------------\n"
<< "To Create a Movie we need the following information (Without space):\n"
<< "Title: Title of the Movie\n"
<< "Synopsis: A short summary of the movie\n"
<< "Director: Director of the Movie\n"
<< "Release Year: Year of Publication\n"
<< "-----------------------------------------------\n";
cin.ignore(numeric_limits<streamsize>::max(), '\n');
cout << "Title: \n";
getline(cin, title);
userMovie.setTitle(title);
cout << "Synopsis: \n";
getline(cin, synopsis);
userMovie.setSynopsis(synopsis);
cout << "Director: \n";
getline(cin, director);
userMovie.setDirector(director);
cout << "Release Year: \n";
cin >> ryear;
userMovie.setRYear(ryear);
return userMovie;
}
/*
* Funcion PrintMovie
*
* La funcion se encarga de imprimer la Movie
*/
void Movie :: printMovie(Movie movie){
cout << "Movie" << endl;
cout << "----------------------------------------------------------------------------" << endl;
cout << "Title: " << movie.getTitle() << endl;
cout << endl;
cout << "Synopsis: " << movie.getSynopsis() << endl;
cout << endl;
cout << "Director: " << movie.getDirector() << endl;
cout << endl;
cout << "Released Year: " << movie.getRYear() << endl;
cout << endl;
}