Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions