-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMovie.cpp
More file actions
executable file
·76 lines (63 loc) · 1.76 KB
/
Movie.cpp
File metadata and controls
executable file
·76 lines (63 loc) · 1.76 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
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
#include "Movie.h"
#include <string>
#include <fstream>
using namespace std;
//**************************************************************************
// default constructor
Movie::Movie()
{
movieId = '\0';
rating = 0;
votes = 0;
}
//*****************************************************************************
// Parametrized Constructor
Movie:: Movie(string movieId, float rating, int votes)
{
this->movieId = movieId;
this->rating = rating;
this->votes = votes;
}
//*******************************************************************************
// Setters
void Movie::setMovieId(string movieId)
{
this->movieId = movieId;
}
void Movie::setRating(int rating)
{
this->rating = rating;
}
void Movie::setVotes(int votes)
{
this->votes = votes;
}
//***************************************************************************************
// Setters
string Movie::getMovieId()
{
return movieId;
}
float Movie::getRating()
{
return rating;
}
int Movie::getVotes()
{
return votes;
}
//*****************************************************************************************
// == operator overloaded to perform comparision operations
bool Movie::operator==(Movie x)
{
if(this->movieId == x.movieId && this->rating == x.rating && this->votes == x.votes)
return true;
return false;
}
// ****************************************************************************************************
// << operator overloaded to print the object on screen
ostream& operator<<(std::ostream& os, const Movie& movie)
{
os << "Movie ID: "<< movie.movieId <<endl << "Movie rating: "<< movie.rating <<endl << "Movie Votes: "<< movie.votes <<endl;
return os;
}