/*
Programmer: Jennifer Leopold Date: November 7, 2015
File: animal.cpp
Purpose: Implementation file for the Animal class
*/
#include <iostream>
#include "animal.h"
using namespace std;
ostream& operator << (ostream& outs, const Animal& a)
{
outs << a.m_species << ", " << a.m_weight << " kg,"
<< " occupies " << a.m_width << " road sector(s),"
<< " stupidity level " << a.m_stupidity << endl;
return(outs);
}
void Animal::setStupidity(const int stupidity)
{
m_stupidity = stupidity > MAX_STUPIDITY? MAX_STUPIDITY:
stupidity;
m_stupidity = stupidity < MIN_STUPIDITY? MIN_STUPIDITY:
stupidity;
return;
}
void Animal::setWeight(const int weight)
{
m_weight = weight < 0? 1: weight;
return;
}
void Animal::setWidth(const int width)
{
m_width = width < 0? 1: width;
m_width = width > Road::MAX_WIDTH? Road::MAX_WIDTH: width;
return;
}