/* ** Sample class to demonstrate importing and utilising a class you have created - Session 3 ** (c) Copyright 2001 Simon Huggins */ import Bicycle; // Import (allow us to use) the Bicycle class file /* Define main class for this file called RideBike (same name as file) */ public class RideBike { /* Main method required when running an application */ public static void main (String[] args) { // Bicycle myBike; // gives initialization error later - declared, but not initialized Bicycle myBike = new Bicycle(); // Declare and create a new copy of Bicycle // System.out.println("Initial speed is " + myBike.speed); // Private, so cannot see System.out.println("Pushed pedal, speed is " + myBike.pushOnPedal()); System.out.println("Pushed pedal, speed is " + myBike.pushOnPedal()); // Next line won't work as setGear does not return a value // System.out.println("Changed gear to 2 " + myBike.setGear(2)); myBike.setGear(2); System.out.println("Changed gear to 2 - no feedback"); System.out.println("Pushed brake handle, speed is " + myBike.pushBrakeHandle()); System.out.println("Pushed brake handle, speed is " + myBike.pushBrakeHandle()); } // end of main method } // end of RideBike class