Thursday, July 15, 2010

package org.cs212.hello;
public class RoadBike extends Bicycle{
      private int tireWidth; // In millimeters (mm)

      public RoadBike(int startCadence, int startSpeed, int startGear, int newTireWidth){
        super(startCadence, startSpeed, startGear);
        this.setTireWidth(newTireWidth);
      }

      public int getTireWidth(){
        return this.tireWidth;
      }

      public void setTireWidth(int newTireWidth){
        this.tireWidth = newTireWidth;
      }

      public void printDescription(){
        super.printDescription();
        System.out.println("The RoadBike has " + getTireWidth()
                + " MM tires.");
      }
}

No comments:

Post a Comment