Question: Shark NumberOfTeet: int + + Shark ( ( int , , float ) ) + + Swim ( ) ( ) : void + +

Shark
NumberOfTeet: int
++ Shark((int,, float))
++ Swim()(): void
++ Display()(): void
Assume the Shark class above is also a sub class of the Animal class.
a)) Add code to your program to implement the Shark class. The Swim method should display "This
shark is swimming". The Display method should print the value of all the attributes in the Shark
object, including any inherited ones.
b)) Add code to your main()() in the Driver file to create a new Shark object, then invoke the Eat(),(), Swim()() and Display()() methods for that object.
Exercise Three
a)) Add default, primary and copy constructors to all four classes in your program and instantiate new objects of each class in such a way that each of the constructors for each class gets called in main().().
b)) Code mutators and accessors for each attribute ((including the inherited ones)) in each class, then demonstrate how to use these methods on objects created in main()()

Step by Step Solution

3.38 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is an example implementation of the Shark class and the main function in a driver file class Animal attributes and methods of the Animal class cl... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!