forked from Yandex-Practicum/Java-Module-Project-YP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCar.java
More file actions
35 lines (29 loc) · 635 Bytes
/
Car.java
File metadata and controls
35 lines (29 loc) · 635 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
public class Car {
private final String NAME;
private final int SPEED;
private int km;
public int getKm() {
return km;
}
public void setKm(int km) {
this.km = km;
}
public Car(String name, int speed) {
this.NAME = name;
this.SPEED = speed;
this.km = speed * 24;
}
public String getNAME() {
return NAME;
}
public int getSPEED() {
return SPEED;
}
@Override
public String toString() {
return "Car{" +
"name='" + NAME + '\'' +
", speed=" + SPEED +
'}';
}
}