Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise We have the following 5 classes: Base Class: Canidae Derived from Canidae: Fox, Wolf Derived from Fox: Red Fox Derived from Wolf :

Exercise

"

We have the following 5 classes:

Base Class:Canidae

Derived from Canidae:Fox, Wolf

Derived from Fox:Red Fox

Derived from Wolf :Gray Wolf

Use these UML diagrams to code your classes; note: the # symbol means Protected access.

Canidae

#social : string

#coatColor : string

#litterSize : int

+Canidae()

+Canidae(soc : string, color : string, litter : int)

+printInfo() : void

Fox

#continent : string

#habitat : string

+Fox()

+Fox(soc : string, color : string, litter : int, cont : string, hab : string)

+setContinent(cont : string) : void

+getContinent() : string

+setHabitat(hab : string) : void

+getHabitat() : string

+printInfo() : void

Wolf

#packSize : int

#habitat : string

+Wolf()

+Wolf(soc : string, color : string, litter : int, pack : int, hab : string)

+setPack(pack : int) : void

+getPack() : int

+setHabitat(hab : string) : void

+getHabitat() : string

+printInfo() : void

RedFox

-avgWeight : double

-activity : string

RedFox()

RedFox(soc : string, color : string, litter : int, cont : string, hab : string, weight : double, act : string)

+setWeight(wgt : double) : void

+getWeight() : double

+setActivity(activity : string) : void

+getActivity() : string

+printInfo() : void

GrayWolf

-packPosition : string

-gender : string

+GrayWolf()

+Gray Wolf(soc : string, color : string, litter : int, pack : int, hab : string, pos : string, gen : string)

+setPosition(pos : string) : void

+getPosition() : string

+setGender(gen : string) : void

+getGender() : string

+printInfo() : void

Code all five classes using header files and putting member function code into separate .cpp files. Be sure to indicate inheritance when you code the header files for Fox, Wolf, RedFox and GrayWolf. Be sure to include the proper header files where needed.

NOTES:

  • If you use the Add Class tool of Visual Studio, notice that after you enter the name for a class, there is another box titled "Base Class". For the child classes, you can put in the class name of the immediate Parent and then Visual Studio creates the inheritance code for you, that is, it will start the class as (example):

class Fox : public Canidae {

  • The constructors of your derived classes should include the parents' attributes (as shown in the UML) and the current class attributes. Use the parent's constructor for the parent's attributes as shown in the Exercise. Default constructors only need to initialize class attributes; Parent default constructors are automatically called.
  • Your printInfo() methods should call the parent's printInfo() and add any unique information. No redundant print statements allowed! Use inheritance.

In the main function:

Make a RedFox object with this data: In the family Canidae with a social structure of "pair/family", a coat color of "red" and a litter size of 6. As a fox, the continent would include "the northern hemisphere" and its common habitat is "diverse". Its average weight is 12 pounds and it is usually active at "dawn/dusk". Print all information.

Make GrayWolf object with this data: In the family Canidae with a social structure of "pack", a coat color of "white to black" and a litter size of 4. As a wolf, the pack size averages 6 and its usual habitat is "diverse". The gray wolf in question is an alpha male.

"

image text in transcribed
D:\\Devry Archives\\VisualProjects\\CIS 247 Lab 5 Canidae\\Debug\\CIS 247 Lab 5 Canidae exe X Animal in the family Canidae; social order is pair/family, coat color is red and average litter size is 6 This is a fox that can be found in the northern hemisphere and its usual habitat is diverse E This is a red fox with an average weight of 12 1bs and its active time is dawn/dusk Animal in the family Canidae; social order is pack, coat color is white to black and average litter size is 4 This is a type of wolf with an average pack size of 6 and a usual habitat that is diverse This is a male gray wolf whose pack position is alpha Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Students also viewed these Programming questions

Question

1 . Television News channels importantance of our Life pattern ?

Answered: 1 week ago

Question

1. How is the newspaper help to our daily life?

Answered: 1 week ago

Question

1. Prepare a short profile of Mikhail Zoshchenko ?

Answered: 1 week ago

Question

What is psychology disorder?

Answered: 1 week ago