-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVehicle.java
More file actions
58 lines (31 loc) · 872 Bytes
/
Copy pathVehicle.java
File metadata and controls
58 lines (31 loc) · 872 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
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
public abstract class Vehicle {
private String brand;
private String model;
private double price;
public Vehicle(String brand, String model, double price){
this.brand = brand;
this.model = model;
this.price = price;
}
public String getBrand(){
return this.brand;
}
public void setBrand(String newBrand){
this.brand = newBrand;
}
public String getModel(){
return this.model;
}
public void setModel(String newModel){
this.model = newModel;
}
public double getPrice(){
return this.price;
}
public void setPrice(double newPrice){
if (newPrice <= 0) {
throw new IllegalArgumentException("Il prezzo deve essere maggiore di 0");
}
this.price = newPrice;
}
}