hw7_fncts.h

/* Programmer: Jennifer Leopold

Date: March 4, 2016

File: hw7_functs.h

Purpose: Function prototypes used in program that simulates

a healthcare clinic where patients come in with a

complaint, and are prescribed a remedy and charged

for the visit.

*/

#ifndef HW7_FUNCTS_H

#define HW7_FUNCTS_H

#include <iostream>

#include <iomanip>

#include <cstdlib>

using namespace std;

// ***********************************************************

// Constants

const short NUM_AILMENTS = 31; // # possible ailments

const string AILMENTS[NUM_AILMENTS] = // possible ailments

{"Jaundice", "Pink Eye", "Pleurisy",

"Hangnail", "Busted Spleen", "Warts",

"Bad Breath", "Stoopititis",

"Diarrhea", "Lice", "Drunken Stupor",

"Tape Worm", "Toothache", "Fat Head",

"Small Head", "Big Feet", "Booger Problems",

"Hangover", "Too Many Arms", "Too Few Fingers",

"Naval Lint", "Rotten Teeth", "Acne",

"Neck Crick", "Dandruff", "Cold", "Mumps",

"Flu", "Rabies", "Mad-cow Syndrome",

"Missing Head"};

const short AILMENT_LENGTH = 18; // spaces for ailment

// output

const short NUM_REMEDIES = 18; // # possible remedies

const string REMEDIES[NUM_REMEDIES] = // possible remedies

{"toothpaste", "snake oil", "toe jam",

"stump water", "plutonium", "terbacker juice",

"aspirin", "moonshine", "mudpie",

"armadillo scales", "rendered possum fat",

"burnt possum hair", "drippy possum nose",

"skunk stink", "road tar", "mouthwash",

"more moonshine", "earwax"};

const short REMEDY_LENGTH = 22; // spaces for remedy

// output

const short NUM_NAMES = 36; // # possible names

const string PATIENT_NAMES[NUM_NAMES] = // possible patients

{"Barney", "Bart", "Homer", "Lisa",

"Marge", "Chief Wiggum", "Ralph", "Jimbo",

"Mr. Burns", "Kearny", "Smithers", "Flanders",

"Krusty", "Skinner", "Jasper", "Maggie",

"Patty", "Selma", "Kent", "Bumblebee man",

"Doris", "Willie", "Prof. Frink", "Dr. Hibbert",

"Kang", "Kodos", "Edna", "Lenny", "Rev. Lovejoy",

"Otto", "Hans Moleman", "Apu", "Quimby",

"Dr. Nick", "Nelson", "Brandine"};

const short NAME_LENGTH = 14; // spaces for name

// output

const short MAX_NUM_PATIENTS = 12; // max # patients

// doctor will see

const int MAX_BILL_AMOUNT = 25; // max & min charges

const int MIN_BILL_AMOUNT = 5; // for seeing doctor

const short TAB_LENGTH = 8; // # spaces in '\t'

// ***********************************************************

// Type declarations

struct patient

{

string name; // patient's name

string ailment; // what is ailing the patient

string remedy; // doctor's prescribed remedy

int bill; // charge for seeing the doctor

};

// ***********************************************************

// Function prototypes

// Randomly choose a patient name from PATIENT_NAMES.

// Preconditions: None.

// Postconditions: A randomly chosen name from PATIENT_NAMES

// is returned.

string choosePatientName();

// Randomly choose an ailment from AILMENTS.

// Preconditions: None.

// Postconditions: A randomly chosen ailment from AILMENTS

// is returned.

string chooseAilment();

// Randomly choose a remedy from REMEDIES.

// Preconditions: None.

// Postconditions: A randomly chosen remedy from REMEDIES

// is returned.

string chooseRemedy();

// Randomly choose a bill amount.

// Preconditions: None.

// Postconditions: A randomly chosen bill amount between

// MIN_BILL_AMOUNT and MAX_BILL_AMOUNT (inclusive) is returned.

int chooseBillAmount();

// Construct a patient with a randomly chosen name, ailment,

// remedy, and bill amount.

// Preconditions: None.

// Postconditions: A patient with a randomly chosen name,

// ailment, remedy, and bill amount is returned.

patient makeRandomPatient();

// Output information about a patient.

// Preconditions: Parameter 'p' contains patient data.

// Postconditions: The information for the specified patient

// has been output to the screen.

void printPatient(const patient p);

// Prompt for and get 'Y' or 'N' input from the user.

// Preconditions: Parameter 'prompt' contains a string

// question the user is answering 'Y' or 'N' to.

// Postconditions: Either 'Y' or 'N' is returned.

char getYNInput(const string prompt);

// Sort the contents of the patients array into descending

// order by patient name.

// Preconditions: Parameter 'numPatients' should be >= 0 and

// parameter 'p' should contain data in positions 0..

// numPatients-1.

// Postconditions: p[0]..p[numPatients-1] are in order by

// patient name.

void sortPatientArray(patient p[], const int numPatients);

// Output the contents of the patients array.

// Preconditions: Parameter 'numPatients' should be >= 0 and

// parameter 'p' should contain data in positions 0..

// numPatients-1.

// Postconditions: The information for p[0]..p[numPatients-1]

// have been output to the screen.

void printPatientArray(const patient p[],

const int numPatients);

#endif