1. create a class called Vehicle that contains fields for the vehicle's maximum speed and number of wheels. provide both a default constructor and
2 argument constructor. provide accessor (get) and mutator (set) methods for the fields. (Solution: vehicle.java) 2. create a subclass of Vehicle called Bicycle that contains a field for the number of gears on the bike. all bikes should have 2 wheels. (Solution: Bicycle.java)
3. add a 'toString ()' method to both classes. Have Bicycle's toString() use Vehicle's toString().
4. write an application that creates a Vehicle with 3 wheels and a top speed of 45 mph (like an ATV) and a Bicycle with 10 gears and a top speed of 30 mph. display both objects. (Solutions:Vehicle.java, Bicycle.java, VehicleTest.java)
5. declare an arry of 3 Vehicles. Make the first two elements Bicycle objects: a 10-speed and a 3-speed. Make the third element just a Vehicle object.
6. Write a loop that runs through the arry, printing each object. Which toString() method is called each time? (Solution: VehicleArray.java)