public class Bike {
private String biketype;
private String bcolor;
private int bprice;
private int bspeed;
public Bike(){}
public Bike(String biketype, String bcolor, int bprice, int bspeed) {
this.biketype = biketype;
this.bcolor = bcolor;
this.bprice = bprice;
this.bspeed = bspeed;
}
public String getBiketype() {
return biketype;
}
public void setBiketype(String biketype) {
this.biketype = biketype;
}
public String getBcolor() {
return bcolor;
}
public void setBcolor(String bcolor) {
this.bcolor = bcolor;
}
public int getBprice() {
return bprice;
}
public void setBprice(int bprice) {
this.bprice = bprice;
}
public int getBspeed() {
return bspeed;
}
public void setBspeed(int bspeed) {
this.bspeed = bspeed;
}
public void show() {
System.out.println("biketype='" + biketype + '\'' +
", bcolor='" + bcolor + '\'' +
", bprice=" + bprice +
", bspeed=" + bspeed );
}
}
public class Mountainbike extends Bike{
private int typePressure;
public Mountainbike(int typePressure) {
this.typePressure = typePressure;
}
public Mountainbike(String biketype, String bcolor, int bprice, int bspeed, int typePressure) {
super(biketype, bcolor, bprice, bspeed);
this.typePressure = typePressure;
}
public void addSpeed(int speed){
this.setBspeed(this.getBspeed()+speed);
}
public void subSpeed(int speed){
this.setBspeed(this.getBspeed()-speed);
}
@Override
public void show() {
super.show();
}
}