Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Do it with Inherentenc method please not for the construction classes For this p

ID: 3600731 • Letter: D

Question


Do it with Inherentenc method please not for the construction classes
For this project you will start with a base class that will represent animals in a zoo: Animal.h and Animal.o. I will provide this base class and the object code needed to link it to your code From this generic type you will inherit derived classes: 1) Mammal Body temperature: double Body temperature high/low: double, double Functions to retum and update Body temperature . . . Boolean function: is body temperature is in range 2) Reptile nvironment-Type: water or land Functions to retum and update Environment-Type From these you will inherit derived classes: a) Mammal i) Elephant . Diet-type: Herbivore Feed-type: Hay Body temp: 97-98 deg . Weight-in-pounds: double (12000 15000) . .Functions to return and update Weight-in-pounds . Boolean function: is body weight in range li) Skunk . Diet-type: Omnivore . Feed-type: grubs and grass shoots . Body temp: 95 - 97 deg . De-scented: bool .Functions to return and update De-

Explanation / Answer

//File Name: Animal.h
#include<iostream>
using namespace std;
class Animal
{
string type;
public:
Animal();
void setAnimal(string);
string getAnimal();
};

------------------------------------------------------------------------------------

//File Name: Animal.cpp
#include"Animal.h"
Animal::Animal()
{
type = "";
}
void Animal::setAnimal(string ty)
{
type = ty;
}
string Animal::getAnimal()
{
return type;
}

---------------------------------------------------------------------

//File Name: Mamal.h
#include<iostream>
using namespace std;
class Mamal : public Animal
{
double bodyTemp;
double bodyTempHigh;
double bodyTempLow;
public:
Mamal();
void setBodyTemp(double);
void setBodyTempHigh(double);
void setBodyTempLow(double);
double getBodyTemp();
double getBodyTempHigh();
double getBodyTempLow();
double updateBodyTemp(double);
bool isRange();
};

-------------------------------------------------------------------------------------

//File Name: Mamal.cpp
Mamal::Mamal()
{
bodyTemp = bodyTempHigh = bodyTempLow = 0;
}
void Mamal::setBodyTemp(double bt)
{
bodyTemp = bt;
}
void Mamal::setBodyTempHigh(double h)
{
bodyTempHigh = h;
}
void Mamal::setBodyTempLow(double l)
{
bodyTempLow = l;
}
double Mamal::getBodyTemp()
{
return bodyTemp;
}
double Mamal::getBodyTempHigh()
{
return bodyTempHigh;
}
double Mamal::getBodyTempLow()
{
return bodyTempLow;
}
double Mamal::updateBodyTemp(double t)
{
return (bodyTemp + t);
}
bool Mamal::isRange()
{
if(bodyTemp >= bodyTempLow && bodyTemp <= bodyTempHigh)
return true;
else
return false;
}

-----------------------------------------------------------------------

//File Name: Reptile.h
#include<iostream>
using namespace std;

class Reptile : public Animal
{
string environmentType;
public:
Reptile();
void setEnvironmentType(string);
string getEnvironmentType();
};

----------------------------------------------------------------------------

//File Name: Reptile.cpp
#include"Reptile.h"
Reptile::Reptile()
{
environmentType = "";
}
void Reptile::setEnvironmentType(string ty)
{
environmentType = ty;
}

string Reptile::getEnvironmentType()
{
return environmentType;
}

---------------------------------------------------------------------------------

//File Name: Elephant.h
#include"Mamal.h"
#include<iostream>
using namespace std;

class Elephant : public Mamal
{
string dietType;
string feedType;
double weight;
double weightHigh;
double weightLow;
public:
void setDietType(string);
void setFeedType(string);
void setWeight(double);
void setWeightHigh(double);
void setWeightLow(double);
string getDietType();
string getFeedType();
double getWeight();
double getWeightHigh();
double getWeightLow();
bool isWeightRange();

};

-------------------------------------------------------------------------------------------------------

//File Name: Elephant.cpp
#include"Elephant.h"
void Elephant::setDietType(string t)
{
dietType = t;
}
void Elephant::setFeedType(string f)
{
feedType = f;
}
void Elephant::setWeightHigh(double wh)
{
weightHigh = wh;
}
void Elephant::setWeightLow(double wl)
{
weightLow = wl;
}
string Elephant::getDietType()
{
return dietType;
}
string Elephant::getFeedType()
{
return feedType;
}
void Elephant::setWeight(double w)
{
weight = w;
}

double Elephant::getWeight()
{
return weight;
}
double Elephant::getWeightHigh()
{
return weightHigh;
}
double Elephant::getWeightLow()
{
return weightLow;
}
bool Elephant::isWeightRange()
{
if(weight >= weightLow && weight <= weightHigh)
return true;
else
return false;
}

---------------------------------------------------------------------------------------

//File Name: MainAnimal.cpp
#include"Animal.cpp"
#include"Elephant.cpp"
#include"Mamal.cpp"
#include<iostream>
using namespace std;

int main()
{
Elephant e;
e.setAnimal("Mamal");
e.setBodyTemp(100);
e.setDietType("Herbivore");
e.setBodyTempHigh(98);
e.setBodyTempLow(97);
e.setWeight(100);
e.setWeightHigh(15000);
e.setWeightLow(12000);
cout<<" Animal type: "<<e.getAnimal()<<" Body Temperature: "<<e.getBodyTemp()<<" Temperature Range: "<<e.getBodyTempHigh()<<" - "<<e.getBodyTempLow();
cout<<" Weight: "<<e.getWeight()<<" Weight Range: "<<e.getWeightHigh()<<" - "<<e.getWeightLow();
cout<<" Is temperature in range: ";
if(e.isRange())
cout<<"True";
else
cout<<"False";
cout<<" Is weight in range: ";
if(e.isWeightRange())
cout<<"True";
else
cout<<"False";


}

Sample Run:

Animal type: Mamal
Body Temperature: 100 Temperature Range: 98 - 97
Weight: 100 Weight Range: 15000 - 12000
Is temperature in range: False
Is weight in range: False

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote