public abstract class HummerModel {
public HummerModel() {
}
public abstract void start();
public abstract void stop();
public abstract void alarm();
public abstract void engineBoom();
public void run()
{
start();
engineBoom();
alarm();
stop();
}
}
public class HummerH1Model extends HummerModel {
@Override
public void start() {
System.out.println("Hummer H1 start");
}
@Override
public void stop() {
System.out.println("Hummer H1 Stop");
}
@Override
public void alarm() {
System.out.println("Hummer H1 alarm");
}
@Override
public void engineBoom() {
System.out.println("Hummer H1 engine boom");
}
}
public class HummerH2Model extends HummerModel {
@Override
public void start() {
System.out.println("Hummer H2 start");
}
@Override
public void stop() {
System.out.println("Hummer H2 Stop");
}
@Override
public void alarm() {
System.out.println("Hummer H2 alarm");
}
@Override
public void engineBoom() {
System.out.println("Hummer H2 engine boom");
}
}