-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVehicle.java
More file actions
43 lines (37 loc) · 1.59 KB
/
Copy pathVehicle.java
File metadata and controls
43 lines (37 loc) · 1.59 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
package com.parking.model;
import java.time.LocalDateTime;
public class Vehicle {
private String licensePlate;
private String ownerName;
private VehicleType type;
private LocalDateTime entryTime;
private LocalDateTime exitTime;
private String assignedSpotId;
private double totalCharge;
public enum VehicleType {
CAR, MOTORCYCLE, TRUCK, EV, HANDICAPPED
}
public Vehicle(String licensePlate, String ownerName, VehicleType type) {
this.licensePlate = licensePlate;
this.ownerName = ownerName;
this.type = type;
this.entryTime = LocalDateTime.now();
}
// Getters and Setters
public String getLicensePlate() { return licensePlate; }
public String getOwnerName() { return ownerName; }
public VehicleType getType() { return type; }
public LocalDateTime getEntryTime() { return entryTime; }
public void setEntryTime(LocalDateTime entryTime) { this.entryTime = entryTime; }
public LocalDateTime getExitTime() { return exitTime; }
public void setExitTime(LocalDateTime exitTime) { this.exitTime = exitTime; }
public String getAssignedSpotId() { return assignedSpotId; }
public void setAssignedSpotId(String assignedSpotId) { this.assignedSpotId = assignedSpotId; }
public double getTotalCharge() { return totalCharge; }
public void setTotalCharge(double totalCharge) { this.totalCharge = totalCharge; }
@Override
public String toString() {
return String.format("Vehicle[plate=%s, owner=%s, type=%s, spot=%s]",
licensePlate, ownerName, type, assignedSpotId);
}
}