03 | public static void main( String args[ ] ) { |
04 | int gear = Integer.parseInt( args[ 0 ] ); |
05 | int speed = Integer.parseInt( args[ 1 ] ); |
06 | int height = Integer.parseInt( args[ 2 ] ); |
07 | int up = Integer.parseInt( args[ 3 ] ); |
08 | int down = Integer.parseInt( args[ 4 ] ); |
09 | int newH = Integer.parseInt( args[ 5 ] ); |
10 | MountainBike mb = new MountainBike( gear, speed, height ); |
12 | mb.applyBrake( down ); |
13 | mb.setHeight ( newH ); |
14 | System.out.println( mb.toString( ) ); |
24 | public Bicycle( int gear, int speed ) { |
29 | public void applyBrake( int decrement ) { |
32 | public void speedUp( int increment ) { |
36 | public String toString( ) { |
37 | return ( "Number of gears is " + gear + "\n" + |
38 | "Speed of bicycle is " + speed + "\n" ); |
42 | class MountainBike extends Bicycle { |
44 | public int seatHeight; |
47 | public MountainBike( int gear, int speed, int startHeight ) { |
50 | seatHeight = startHeight; |
53 | public void setHeight( int newValue ) { |
54 | seatHeight = newValue; |
58 | public String toString( ) { |
59 | return ( super .toString( ) + "Seat height is " + seatHeight ); |
|