hw7.h
// Programmer: Jennifer Leopold date: October 20, 2014
// File: hw7.h
// Purpose: This file contains the header info for the program
// that compares two tests for diagnosing zombie-ism.
#ifndef H7_H
#define H7_H
using namespace std;
// ***********************************************************
// Constants
// Maximum number of patients that can participate in study
const short MAX_NUM_PATIENTS = 5000;
// DNA nucleobases
const char THYMINE = 'T';
const char CYTOSINE = 'C';
const char GUANINE = 'G';
const char ADENINE = 'A';
// Frequency that each nucleobase occurs
const short GUANINE_FREQUENCY = 30;
const short THYMINE_FREQUENCY = 23;
const short ADENINE_FREQUENCY = 27;
const short CYTOSINE_FREQUENCY = 20;
// Length of DNA sample being tested
const short DNA_SEQUENCE_LENGTH = 128;
// Codes describing how a patient smells
const short SMELL_PLEASANT = 0;
const short SMELL_NEUTRAL = 1;
const short SMELL_SLIGHTLY_RIPE = 2;
const short SMELL_ROTTING_STENCH = 3;
const short NUM_ODOR_CODES = 4;
// Codes describing how a patient walks
const short GAIT_NORMAL = 0;
const short GAIT_SHUFFLE = 1;
const short GAIT_CRAWLS = 2;
const short NUM_GAIT_CODES = 3;
// ***********************************************************
// Type declarations
// Information about a patient
struct patientData
{
char dnaSequence[DNA_SEQUENCE_LENGTH];
bool wantsToEatBrains;
short bodyOdor;
short gait;
bool isZombieByDNATest;
bool isZombieByCharTest;
};
// ***********************************************************
// Function prototypes
// The greeting function will output a greeting message
// to the user.
// Preconditions: None
// Postconditions: a message is output to the screen
void greeting();
// Populate an array with patient data.
// Preconditions: Parameter 'numPatients' contains the
// number of patient records to fill in the array (and does
// not exceed MAX_NUM_PATIENTS).
// Postconditions: Array p will contain patient info
// in positions 0..numPatients-1.
void getData(patientData p[], const short numPatients);
// Output the values for all the statistics.
// Preconditions: The parameters have been assigned values.
// Postconditions: Values of the statistics (see parameter
// list) have been output to the screen.
void outputResults(const short numPeople,
const short numWantBrains,
const short numStinky,
const short numAbnormalGait,
const short numZombiesOnlyByDNATest,
const short numZombiesOnlyByCharTest,
const short numZombiesByBothTests);
// For each patient record in the given array, determine
// whether that patient is a zombie according to the test
// that is based on physical characteristics.
// Preconditions: Parameter 'p' contains patientData records
// in positions 0..numPatients-1.
// Postconditions: For i = 0..numPatients-1,
// p[i].isZombieByCharTest = true if the 3 physical
// characteristic tests are true; otherwise,
// p[i].isZombieByCharTest = false.
void testByCharacteristics(patientData p[],
const short numPatients);
// For each patient record in the given array, determine
// whether that patient is a zombie according to the test
// that is based on a segment of DNA.
// Preconditions: Parameter 'p' contains patientData records
// in positions 0..numPatients-1.
// Postconditions: For i = 0..numPatients-1,
// p[i].isZombieByDNATest = true if p[i].dnaSequence contains
// the subsequence GTAC; otherwise, p[i].isZombieByDNATest =
// false.
void testByDNA(patientData p[], const short numPatients);
// Count the number of patients that match various conditions.
// Preconditions: Parameter 'p' contains patientData records
// in positions 0..numPatients-1.
// Postconditions: Counts for patient matching various
// conditions (see parameter list) are returned.
void collectStatistics(const patientData p[],
const short numPatients,
short &numWantBrains,
short &numStinky,
short &numAbnormalGait,
short &numZombiesOnlyByDNATest,
short &numZombiesOnlyByCharTest,
short &numZombiesByBothTests);
// Calculate the percentage that one number is of another
// number.
// Preconditions: Parameters 'numerator' and 'denominator'
// have values.
// Postconditions: The percentage that numerator is of
// denominator is returned.
float percent(const short numerator, const short denominator);
// Prompt the user to enter the number of people to be
// tested in this study.
// Preconditions: None.
// Postconditions: A number greater than 0 and less than or
// equal to MAX_NUM_PATIENTS is returned.
short getNumPeopleTested();
// The goodbye function will output an exiting message
// to the user.
// Preconditions: none
// Postconditions: A message is output to the screen
void goodbye();
#endif