hw9.cpp
/* Programmer: Jennifer Leopold date: November 14, 2014
File: hw9.cpp
Purpose: This program simulates a hospital that contains
an x-ray machine. Patients are admitted to the
hospital and are charged for having x-rays taken.
A certain percentage of the time, patients also
incur health damages which may cause them to die.
The amount of money that each patient has and
his/her health status is maintained over the
simulation.
To compile:
fg++ hw9.cpp hospital.cpp patient.cpp x_rayer.cpp -o hw9
To execute: ./hw9
*/
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string.h>
#include "patient.h"
#include "hospital.h"
using namespace std;
const short NUM_TIMES_TO_ADMIT_PATIENT = 5;
const short NUM_PATIENTS = 3;
int main()
{
Hospital hospital_room;
// Seed the random number generator
srand(time(NULL));
Patient p[NUM_PATIENTS]; // patients to be randomly created
// Output initial state of hospital_room
cout << "Initially the hospital has this configuration:\n";
cout << hospital_room << endl;
// Output initial state of each patient
cout << "\nInitial patients are as follows:\n";
for (short i = 0; i < NUM_PATIENTS; i++)
cout << (i+1) << ". " << p[i] << endl;
// Admit 1st patient to hospital room a number of times
for (short i = 1; i <= NUM_TIMES_TO_ADMIT_PATIENT; i++)
hospital_room.admit(p[0]);
// Output new state of hospital_room
cout << "\nAfter our simulation the hospital now has this "
<< "configuration:\n";
cout << hospital_room << endl;
// Output new state of 1st patient
cout << "\nAnd the first patient now looks like this:\n";
cout << p[0] << endl;
cout << "\nThat concludes this simulation.\n";
return 0;
}