-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMovie.java
89 lines (83 loc) · 1.87 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
84
85
86
87
88
89
public class Movie {
private String title;
private String rating;
private int soldTickets;
/**
* Default no arg0 Constructor
*/
public Movie ()
{
title = "";
rating = "";
soldTickets = 0;
}
/**
* Copy Constructor that produces a deep copy of the argument
* @param m A Movie Object
*/
public Movie (Movie m)
{
title = m.title;
rating = m.rating;
soldTickets = m.soldTickets;
}
/**
* Constructor that takes data as input and sets them.
* @param title the title of the movie
* @param rating the rating of the movie
* @param soldTickets number of tickets sold at this theater
*/
public Movie(String title, String rating, int soldTickets) {
this.title = title;
this.rating = rating;
this.soldTickets = soldTickets;
}
/**
* Returns the movie's title
* @return a String corresponding to the movie title
*/
public String getTitle() {
return title;
}
/**
* sets movie's title
* @param title the title of the movie
*/
public void setTitle(String title) {
this.title = title;
}
/**
* returns movie's rating
* @return a string for movie rating
*/
public String getRating() {
return rating;
}
/**
* sets movie's rating
* @param rate movie rating
*/
public void setRating(String rating) {
this.rating = rating;
}
/**
* returns number of sold tickets
* @return an int representing number of tickets sold
* */
public int getSoldTickets() {
return soldTickets;
}
/**
* sets number of sold tickets
* @param soldTickets number of the soldTickets
*/
public void setSoldTickets(int soldTickets) {
this.soldTickets = soldTickets;
}
/**
* Returns a string with relevant movie information
*/
public String toString() {
return (this.title+" ("+this.rating+"): Tickets Sold: "+this.soldTickets);
}
}