public class Vehicle {
int speed;
int size;
Vehicle(){
speed=0;
size=0;
}
Vehicle(int speed,int size){
this.speed=speed;
this.size=size;
}
public void move()
{
}
public void setSpeed(int speed) {
this.speed=speed;
}
public void setSize(int size) {
this.size=size;
}
public void speedUp(int i) {
speed+=i;
}
public void speedDown(int j) {
speed-=j;
}
public String toString(){
return "speed:"+speed+",size:"+size;
}
int speed;
int size;
Vehicle(){
speed=0;
size=0;
}
Vehicle(int speed,int size){
this.speed=speed;
this.size=size;
}
public void move()
{
}
public void setSpeed(int speed) {
this.speed=speed;
}
public void setSize(int size) {
this.size=size;
}
public void speedUp(int i) {
speed+=i;
}
public void speedDown(int j) {
speed-=j;
}
public String toString(){
return "speed:"+speed+",size:"+size;
}
}
public class TestVehicle {
public static void main(String[] args) {
// TODO Auto-generated method stub
Vehicle v=new Vehicle();
v.setSpeed(2);
v.setSize(1);
System.out.println(v);
v.speedUp(5);
System.out.println(v);
v.speedDown(6);
System.out.println(v);
}
}