-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bicicletta.java
41 lines (32 loc) · 914 Bytes
/
Bicicletta.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
package prg.es3;
public class Bicicletta extends Veicolo{
private String modello;
public void muovi(double tempo){
this.setX(this.getX()+this.getVx()*tempo+this.getAx()*Math.pow(tempo, 2));
this.setY(Math.cos(this.getX()));
this.setVx(this.getAx()*tempo + this.getVx());
}
//Costruttori:
public Bicicletta(){}
public Bicicletta(String modello){
this.setModello(modello);
}
public Bicicletta(double ax, double ay){
super(ax, ay);
}
public Bicicletta(double x, double y, double vx, double vy, double ax, double ay){
super(x, y, vx, vy, ax, ay);
}
public Bicicletta setModello(String valore){
this.modello = valore;
return this;
}
public String getModello(){
return this.modello;
}
//Metodo toString:
public String toString(){
return "Modello: " + this.getModello() + ", " + super.toString();
}
//implementa equals e toString
}