-
Notifications
You must be signed in to change notification settings - Fork 0
/
CriminalRecord.java
82 lines (68 loc) · 2.82 KB
/
CriminalRecord.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
package main;
public class CriminalRecord {
public static final String BREAKING_AND_ENTERING = "Breaking and entering";
public static final String DRUG_TRAFFICKING = "Drug trafficking";
public static final String DRUG_USE = "Drug use";
public static final String ECOLOGICAL = "Ecological";
public static final String FRAUD = "Fraud";
public static final String HOMICIDE = "Homicide";
public static final String KIDNAPPING = "Kidnapping";
public static final String THEFT = "Theft";
public static final String TRAFFIC = "Traffic";
public static final String VIOLENCE = "Violence";
public static final int MAXIMUM_CONVICTION_SLIGHT = 5;
public static final int MAXIMUM_CONVICTION_SERIOUS = 15;
public static final int MAXIMUM_CONVICTION_VERY_SERIOUS = 16;
public static final String SLIGHT = "Slight";
public static final String SERIOUS = "Serious";
public static final String VERY_SERIOUS = "Very Serious";
private String description;
private int identifier;
private String type;
private String severity;
private int yearSentence;
public CriminalRecord(int id, String type, String description){
this.identifier = id;
this.type = type;
this.description = description;
this.yearSentence = 0;
this.determineSeverity();
}
public void changeSentence(int newSentence){
this.yearSentence = newSentence;
}
public void determineSeverity(){
String crime = this.getType();
if (crime.equalsIgnoreCase(ECOLOGICAL) || crime.equalsIgnoreCase(TRAFFIC) || crime.equalsIgnoreCase(DRUG_USE)){
this.severity = SLIGHT;
}
if (crime.equalsIgnoreCase(BREAKING_AND_ENTERING) || crime.equalsIgnoreCase(THEFT) || crime.equalsIgnoreCase(FRAUD)){
this.severity = SERIOUS;
}
if (crime.equalsIgnoreCase(HOMICIDE) || crime.equalsIgnoreCase(VIOLENCE) || crime.equalsIgnoreCase(KIDNAPPING) || crime.equalsIgnoreCase(DRUG_TRAFFICKING)){
this.severity = VERY_SERIOUS;
}
}
public String getDescription(){
return this.description;
}
public int getIdentifier(){
return this.identifier;
}
public String getSeverity(){
return this.severity;
}
public String getType(){
return this.type;
}
public int getYearSentence(){
return this.yearSentence;
}
public String toString(){
return "Id: " + this.getIdentifier() +
"\nType: " + this.getType() +
"\nDescription: " + this.getDescription() +
"\nSentence (Years): " + this.getYearSentence() +
"\nSeverity: " + this.getSeverity();
}
}