patient.h
// Programmer: Jennifer Leopold date: November 14, 2014
// File: patient.h
// Purpose: This file contains the definition of the
// Patient class.
#ifndef PATIENT_H
#define PATIENT_H
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <string.h>
#include <math.h>
using namespace std;
const int MAX_INITIAL_FUNDS = 4000;
const int PERFECT_HEALTH = 100;
const int DEAD = 0;
const char PATIENT_NAME_FILE[] = "names.dat";
class Patient
{
public:
// Default constructor for Patient
// Preconditions: None
// Postconditions: Values for m_money, m_condition,
// and m_name randomly assigned; value for m_isAlive
// assigned based on value for m_condition
Patient();
// Deduct specified amount from patient's assets
// Preconditions: Parameter amount is valid integer
// Postconditions: Value for m_money is reduced by
// amount
void pay_out(const float amount);
// Deduct specified amount from patient's condition
// Preconditions: Parameter conditionModifier is valid
// integer
// Postconditions: Value for m_condition is reduced by
// conditionModifier; if m_condition == DEAD,
// function kill is called (see below)
void modify_health(const int conditionModifier);
// Accessor for condition
// Preconditions: None
// Postcondition: Value of m_condition is returned
int getCondition() const { return(m_condition); }
// Randomly choose a name from PATIENT_NAME_FILE
// Preconditions: None
// Postconditions: A string name from PATIENT_NAME_FILE
// is returned
string randomlyChooseName() const;
// Overloaded operator for << (as friend function)
// Preconditions: None
// Postconditions: Patient'ss member variable values will
// be output to outs (thereby modifying ostream outs)
friend ostream& operator << (ostream& outs,
const Patient& p);
private:
// Change patient's alive status if condition is DEAD
// Preconditions: None
// Postconditions: Value for m_isAlive is set to false
// if m_condition is == DEAD; otherwise, its value is
// unchanged
void kill();
private:
float m_money; // amount of money patient has
bool m_isAlive; // whether or not patient is alive
int m_condition; // DEAD..PERFECT_HEALTH
string m_name; // patient's name (no spaces)
};
#endif