/** * Class demonstrates an abstract class. * This class can provide implementation and an interface to * subclasses of GenericBike * The keyword "abstract" tells us that the class can't be instantiated * Abstract classes cannot be final! */ public abstract class GenericBike { /* Since this class is defined as being abstract, there is no reason to define constructor methods in an abstract class */ /** * Abstract methods don't have any implementation. * Set the design for other classes and provide an * architectural interface for all applications * All abstract methods must be defined in subclasses */ public abstract int getRotationalSpeed(); /** * Returns the wheel size * @param wheelSize the bike's wheel size in inches */ public void setWheelSize( int size ) { this.wheelSize = size; } /** * Sets the wheel size * Size is considered to be in inches * @return wheel size */ public int getWheelSize() { return this.wheelSize; } /** * Returns the bike size * Size can be LARGE, MEDIUM, OR SMALL * @return bike size */ public String getSize(){ return size; } /** * Sets the bike size * Size can be LARGE, MEDIUM, OR SMALL * @param size the bike's new size */ public void setSize(String size){ this.size = size; } /** * Returns the bike weight * Weight should be specified in terms of pounds. * @return bike's weight */ public int getWeight(){ return weight; } /** * Size the bike weight * Weight should be set in terms of pounds * @param weight the bikes new weight */ public void setWeight(int weight){ this.weight = weight; } /** * Returns the bike's speed ( how many gears ) * Speed can be NINE_SPEED, EIGHT_SPEED, * ONE_SPEED, TWENTYONE_SPEED * @return bike's speed */ public int getSpeed(){ return bikeSpeed; } /** * Sets the bike's speed ( how many gears ) * Speed can be NINE_SPEED, EIGHT_SPEED, * ONE_SPEED, TWENTYONE_SPEED * @param bikeSpeed bike speed */ public void setBikeSpeed(int bikeSpeed){ this.bikeSpeed = bikeSpeed; } public static final int NINE_SPEED = 9; public static final int EIGHT_SPEED = 8; public static final int ONE_SPEED = 1; public static final int TWENTYONE_SPEED = 21; public static final int UNKNOWN_SPEED = -1; public static final int LARGE = 200; public static final int MEDIUM = 201; public static final int SMALL = 202; private int bikeSpeed; private int weight; private String size; protected int wheelSize; }