-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCinema.java
More file actions
47 lines (37 loc) · 1016 Bytes
/
Cinema.java
File metadata and controls
47 lines (37 loc) · 1016 Bytes
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
package uk.co.c2b2.jdg.hotrod;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @author David Winters
*/
public class Cinema implements Serializable {
private static final long serialVersionUID = -181403229462007401L;
private String cinemaName;
private List<String> shows;
public Cinema(String cinemaName) {
this.cinemaName = cinemaName;
shows = new ArrayList<String>();
}
public void addShow(String name) {
shows.add(name);
}
public void removeShow(String name) {
shows.remove(name);
}
public List<String> getShows() {
return shows;
}
public String getName() {
return cinemaName;
}
@Override
public String toString() {
StringBuilder b = new StringBuilder("=== Cinema: " + cinemaName + " ===\n");
b.append("Show:\n");
for (String show : shows) {
b.append("- " + show + "\n");
}
return b.toString();
}
}