-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoliceOfficer.java
More file actions
30 lines (29 loc) · 973 Bytes
/
PoliceOfficer.java
File metadata and controls
30 lines (29 loc) · 973 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
public class PoliceOfficer {
private String officerName;
private int officerBadge;
private static String theTicket;
private static boolean violation = false;
public PoliceOfficer(int officerBadge, String officerName) {
this.officerBadge = officerBadge;
this.officerName = officerName;
}
public void setOfficer(String officerName) {
this.officerName = officerName;
}
public void setBadge(int officerBadge) {
this.officerBadge = officerBadge;
}
public String getOfficer() {
return officerName;
}
public int getBadge() {
return officerBadge;
}
public static String issueTicket(ParkedCar vehicle, PoliceOfficer officer, ParkingTicket minutes) {
if(vehicle.getMinutes() > minutes.getPurchasedMin()) {
violation = true;
}
theTicket = ParkingTicket.toString(vehicle, officer, violation, minutes);
return theTicket;
}
}