-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVeicolo.java
88 lines (68 loc) · 1.48 KB
/
Veicolo.java
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
package prg.es3;
public abstract class Veicolo{
private double x;
private double y;
private double vx;
private double vy;
private double ax;
private double ay;
public abstract void muovi(double tempo);
//Costruttori:
public Veicolo(){}
public Veicolo(double ax, double ay){
this.setAx(ax).setAy(ay);
}
public Veicolo(double x, double y, double vx, double vy, double ax, double ay){
this(x ,y);
this.setVx(vx).setVy(vy).setAx(ax).setAy(ay);
}
//Metodi set:
public Veicolo setX(double value){
this.x = value;
return this;
}
public Veicolo setY(double value){
this.y = value;
return this;
}
public Veicolo setVx(double value){
this.vx = value;
return this;
}
public Veicolo setVy(double value){
this.vy = value;
return this;
}
public Veicolo setAx(double value){
this.ax = value;
return this;
}
public Veicolo setAy(double value){
this.ay = value;
return this;
}
//Metodi get:
public double getX(){
return x;
}
public double getY(){
return y;
}
public double getVx(){
return vx;
}
public double getVy(){
return vy;
}
public double getAx(){
return ax;
}
public double getAy(){
return ay;
}
//Metodo toString:
public String toString(){
return "(" + this.getX() + ", " + this.getY() + "), vx = " + this.getVx() + ", vy = " + this.getVy() + ", ax = " + this.getAx() + ", ay = " + this.getAy();
}
//implementa equals e toString
}