class CAR {
private boolean engineOn;
private float fuelTank;
private float speed;
private float acceleration;
private float deceleration;
private String owner;
public CAR(boolean engineOn,float fuelTank,float speed,float acceleration,float deceleration,String owner){
this.engineOn=engineOn;
this.fuelTank=fuelTank;
this.speed=speed;
this.acceleration=acceleration;
this.deceleration=deceleration;
this.owner=owner;
}
public void switchEngineOn(){
this.engineOn=!this.engineOn;
}
public void refuel(float f){
this.fuelTank=f;
}
public void setAccelerating(float acc){
this.acceleration=acc;
}
public void setDec(float dec){
this.deceleration=dec;
}
public void setSpeed(float sp){
this.speed=sp;
}
public String toString(){
return "engine:"+engineOn+";"+"fuelTank:"+fuelTank+";speed"+speed+";acceleration:"+acceleration+";deceleration:"+deceleration+";owner:"+owner;
}
}
class MAN{
private String name;
private String surname;
private String address;
private CAR myCar;
public MAN(String name,String surname,String address,CAR myCar){
this.name=name;
this.surname=surname;
this.address=address;
this.myCar=myCar;
}
public String toString(){
return "name:"+name+";surname:"+surname+";address:"+address+";myCar:"+myCar;
}
}
class GARAGE{
public static void main(String[] args){
CAR car=new CAR(false,1,2,3,4,"Mike");
MAN man=new MAN("Mike","joey","beijing",car);
System.out.println(man);
car.switchEngineOn();
car.refuel(2);
car.setAccelerating(10);
car.setDec(5);
car.setSpeed(0);
System.out.println(man);
}
}