Monday, 5 March 2012

LAB 02 - july 2013 - Beginners ( still refreshing mode )

Do the following :

Question 1 :
------------------


  1. Create a class of Vehicles with appropriate properties and a method call accelerate(). In the accelerate() method print "Vehicle is Accelarating". Return nothing.
  2. Create a class of Car ( a subclass of vehicle ) with appropriate properties and methods call accelarate() and changegear(). Overide Accelarate() method by changing the implementation. Changegear method will ask user the gear number to change to , then print the new gear choosen and accelarate.
  1. Create a GearException class that will be thrown if the user choose the gear number < 1 or > 5 . Create appropriate message.Implement Try and catch block where necessary.Print Error message. Continously ask user to enter the right number.
  2. Create a Driver class that create 1 vehicle object and 1 car object using Vehicle type reference. Do accelaration for vehicle and changegear for car.

* Please do the pre-programming processes that you need to do ( OOA, OOD,OOP )
* Submit this to my room C9.01 , after the class.

No comments:

Post a Comment