1. a. Create a parent class "Vehicle" with one method "turnLeft" that prints "Vehicle turning left".
b. Create a child class "Bike" which overrides the "turnLeft" method and prints "Bike turning left".
c. Create a Vehicle reference referring to a Bike object. Is it legal? What happens when the "turnLeft" method is called through the Vehicle reference?

2. a. Create a parent class "Animal" with one method "play" that prints "Animal is playing".
b. Create a child class "Dog" with two methods "bark" and "play" that prints "Dog is barking" and "Dog is playing" respectively. Override the "play" method in the "Dog" class.
c. Create a "Dog" object and invoke the play method. Which play method gets called?
d. Create an Animal reference to the Dog object. Is it legal? What happens when the play method is called through the Animal reference? What happens when the bark method is called through the Animal reference?
e. What happens when you create a Dog reference to the Animal object?

3. Write an object oriented program to simulate an Orchestra with a collection of few musical instruments like Guitar, Piano and Drum. Define a polymorphic method called "Play" in each of the instrument. The Play method will print "Guitar" when Guitar is played, "Piano" when Piano is played, and "Drum" when a Drum is played.

Let us say Cacofonix now joins the Orchestra with his Violin. Extend your program to demonstrate that you don\'t have to touch the existing code corresponding to the other instruments.

1. a. Create a parent class "Vehicle" with one method "turnLeft" that prints "Vehicle turning left".
b. Create a child class "Bike" which overrides the "turnLeft" method and prints "Bike turning left".
c. Create a Vehicle reference referring to a Bike object. Is it legal? What happens when the "turnLeft" method is called through the Vehicle reference?

A vehicle that only turns left. That is scary. I don't want to be in the road with you driving:)

Create a parent class Daniweb, with one method "help me with my homework" which takes two parameters: problemDefinition and whatIDidSoFar.
If the second parameter is null, throw a NoHelpWithoutEffort Exception

Comments
I do not want to be sarcastic, but you got that one right
I will honestly implement that
This article has been dead for over six months. Start a new discussion instead.