-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMovie_Class.java
More file actions
105 lines (81 loc) · 2.32 KB
/
Copy pathMovie_Class.java
File metadata and controls
105 lines (81 loc) · 2.32 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
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
import java.util.*;
import java.text.*;
public class Movie_Class implements java.lang.Comparable<Movie_Class> {
//set variables for movie object
String title;
Date releaseDate;
String description;
Date receiveDate;
public enum movieStatus{
received,
released,
unreceived;
};
movieStatus status;
Scanner scnr = new Scanner(System.in);
DateFormat newFormat = new SimpleDateFormat("yyyy-MM-dd");
public Movie_Class() {}
//default constructor
//constructor with parameters
public Movie_Class(String movie, String d, String s, String r, String c) throws ParseException {
title = movie;
releaseDate = newFormat.parse(d);
description = s;
receiveDate = newFormat.parse(r);
this.setStatus(c);
}
//method to edit the description
public void setTitle(String str) {
title = str;
}
//method to get description
public String getTitle(){
return title;
}
//method to edit the description
public void setDescription(String des) {
description = des;
}
//method to get description
public String getDescription(){
return description;
}
//method to set release date
public void setReleaseDate(String date) throws ParseException {
releaseDate = newFormat.parse(date);
}
//method to get release date
public Date getReleaseDate() {
return releaseDate;
}
//method to set receive date
public void setReceiveDate(String date) throws ParseException {
receiveDate = newFormat.parse(date);
}
//method to get receive date
public Date getReceiveDate() {
return receiveDate;
}
//method to set status
public void setStatus(String c) {
if(c.equals("received")) {
status = movieStatus.received;
}
else if(c.equals("released")) {
status = movieStatus.released;
}
else {
status = movieStatus.unreceived;
}
}//End set status
public movieStatus getStatus() {
return status;
}
@Override
public int compareTo(Movie_Class movie) {
return getReleaseDate().compareTo(movie.getReleaseDate());
}
public String toString() {
return(title + ", " + newFormat.format(releaseDate) + "," + description + ", " + newFormat.format(receiveDate)+ ", " + status);
}
}