Shark NumberOfTeet: int + + Shark ( ( int , , float ) ) + + Swim
Fantastic news! We've Found the answer you've been seeking!
Question:
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()
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date: