x_rayer.h
// Programmer: Jennifer Leopold date: November 14, 2014
// File: x_rayer.h
// Purpose: This file contains the definition of the
// X_Rayer class.
#ifndef XRAYER_H
#define XRAYER_H
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
#include "patient.h"
using namespace std;
const int HOW_OFTEN_XRAY_AFFECTS_PATIENT = 10;
const float CHARGE_FOR_USE = 550;
class X_Rayer
{
public:
// Default constructor for X_Rayer
// Preconditions: None
// Postconditions: m_cost_per_use set to CHARGE_FOR_USE,
// m_num_uses set to 0
X_Rayer() : m_cost_per_use(CHARGE_FOR_USE),
m_num_uses(0) {}
// Charge a patient for using this machine
// Preconditions: None
// Postconditions: Patient p's amount of money will be
// modified via call to pay_out
void charge_patient(Patient &p);
// Modify the patient's health
// Preconditions: None
// Postconditions: Patient p's condition will be
// modified via call to modify_health a certain percentage
// of the time (i.e., HOW_OFTEN_XRAY_AFFECTS_PATIENT)
void apply(Patient &p);
// Overloaded operator for << (as friend function)
// Preconditions: None
// Postconditions: Machine's member variable values will be
// output to outs (thereby modifying ostream outs)
friend ostream& operator << (ostream& outs,
const X_Rayer& x);
private:
float m_cost_per_use; // how much patient charged
short m_num_uses; // how often machine gets used
};
#endif