master
This commit is contained in:
23
src/POO/T2_constructeurs/Car.java
Normal file
23
src/POO/T2_constructeurs/Car.java
Normal file
@ -0,0 +1,23 @@
|
||||
package POO.T2_constructeurs;
|
||||
|
||||
public class Car {
|
||||
String color = "";
|
||||
String type = "";
|
||||
int maxSpeed;
|
||||
|
||||
public Car(String type, String color, int maxSpeed){
|
||||
this.type = type;
|
||||
this.color = color;
|
||||
this.maxSpeed = maxSpeed;
|
||||
}
|
||||
|
||||
public String getStringRepresentation() {
|
||||
String s = type;
|
||||
s += " ";
|
||||
s += color;
|
||||
s += ", vitesse max: ";
|
||||
s += maxSpeed;
|
||||
s += "km/h";
|
||||
return s;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user