// Programmer: Bushra Anjum
// file: Resident.cpp
#include "Resident.h"
Resident::Resident()
{
//SETTING RESIDENT NAME
//static variable to help with picking names from text file
static int name_index=1;
ifstream fin;
fin.open("names.dat");
for (int i = 0; i < name_index;i++)
{
getline(fin,m_name);
}
name_index++;
fin.close();
//SETTING RESIDENT STATE
m_is_alive = true;
m_is_murderer = false;
//SETTING RESIDENT HAIR RANDOMLY [1,10]
m_hair_color = 1 + rand() % HAIR_COLOR_RANGE;
}
void Resident::hair_color_change(int color)
{
m_hair_color = color;
}
void Resident::kill_me()
{
m_is_alive = false;
}
void Resident::set_murderer()
{
m_is_murderer = true;
}
int Resident::get_hair_color()const
{
return m_hair_color;
}
string Resident::get_name()const
{
return m_name;
}