-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVehicle.java
More file actions
129 lines (103 loc) · 3.19 KB
/
Vehicle.java
File metadata and controls
129 lines (103 loc) · 3.19 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
/**
*
* @author kübra
*/
public abstract class Vehicle {
private String plate;
private String id;
private String brand;
private String model;
private double dailyRent;
private int mileage;
private boolean isAvailable;
private String fuelType;
private int productionYear;
public Vehicle(String plate, String id, String brand, String model, double dailyRent,
int mileage, boolean isAvailable, String fuelType, int productionYear) {
this.plate = plate;
this.id = id;
this.brand = brand;
this.model = model;
this.dailyRent = dailyRent;
this.mileage = mileage;
this.isAvailable = isAvailable;
this.fuelType = fuelType;
this.productionYear = productionYear;
}
public String getPlate() {
return plate;
}
public void setPlate(String plate) {
this.plate = plate;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public double getDailyRent() {
return dailyRent;
}
public void setDailyRent(double dailyRent) {
this.dailyRent = dailyRent;
}
public int getMileage() {
return mileage;
}
public void setMileage(int mileage) {
if (mileage>this.mileage) {
this.mileage=mileage;
}
else{
System.out.println("Mileage can't be lower or equal to its current value!");
}
}
public boolean getIsAvailable() {
return isAvailable;
}
public void setIsAvailable(boolean isAvailable) {
this.isAvailable = isAvailable;
}
public String getFuelType() {
return fuelType;
}
public void setFuelType(String fuelType) {
this.fuelType = fuelType;
}
public int getProductionYear() {
return productionYear;
}
public void setProductionYear(int productionYear) {
this.productionYear = productionYear;
}
public abstract double calculateRent(int days);
public void displayInfo() {
System.out.println("VEHICLE INFORMATIONS:");
System.out.println("Brand:" + brand);
System.out.println("Daily Rent:" + dailyRent);
System.out.println("Fuel Type:" + fuelType);
System.out.println("ID:" + id);
System.out.println("Is vehicle available?" + isAvailable);
System.out.println("Mileage:" + mileage);
System.out.println("Model:" + model);
System.out.println("Plate:" + plate);
System.out.println("Production Year:" + productionYear);
}
}