-
Notifications
You must be signed in to change notification settings - Fork 0
/
Movie.java
83 lines (71 loc) · 2.09 KB
/
Movie.java
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
/**
* Template for defining Movie objects with the necessary fields accounted for
* for proper interaction with other classes.
*
* @author Tshepo Mosoeunyane
* @version 11-5-2021
*/
// An immutable passive data object (PDO) to represent item data
public class Movie {
private String id;
private String title;
private int year;
private String genres;
private String director;
private String country;
private String poster;
private int minutes;
public Movie (String anID, String aTitle, String aYear, String theGenres) {
// just in case data file contains extra whitespace
id = anID.trim();
title = aTitle.trim();
year = Integer.parseInt(aYear.trim());
genres = theGenres;
}
public Movie (String anID, String aTitle, String aYear, String theGenres, String aDirector,
String aCountry, String aPoster, int theMinutes) {
// just in case data file contains extra whitespace
id = anID.trim();
title = aTitle.trim();
year = Integer.parseInt(aYear.trim());
genres = theGenres;
director = aDirector;
country = aCountry;
poster = aPoster;
minutes = theMinutes;
}
// Returns ID associated with this item
public String getID () {
return id;
}
// Returns title of this item
public String getTitle () {
return title;
}
// Returns year in which this item was published
public int getYear () {
return year;
}
// Returns genres associated with this item
public String getGenres () {
return genres;
}
public String getCountry() {
return country;
}
public String getDirector() {
return director;
}
public String getPoster() {
return poster;
}
public int getMinutes() {
return minutes;
}
// Returns a string of the item's information
public String toString () {
String result = "Movie [id=" + id + ", title=" + title + ", year=" + year;
result += ", genres= " + genres + "]";
return result;
}
}