Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE HELP C++ QUESTION: Computerizing health records makes it easier for patie

ID: 3725825 • Letter: P

Question

PLEASE HELP C++ QUESTION:

Computerizing health records makes it easier for patients to share their health profiles and histories among their various health care professionals. Write a program that maintains computerized health records for several patients. This includes designing several classes: HealthRecords, Patient, and Checkup. All class attributes must be private and accessed through public member functions.

The attributes of each class are summarized below:

HealthRecords class has the following private attributes:

   vector <Patient> patientsRecords;   

Patient class has the following private attributes:

const long patientAccountNum; // =nextPatientAccountNum string firstName;

   string lastName;

long SSN;

char gender; string birthDate;

   vector <Checkup> patientCheckups;

   static long nextPatientAccountNum; // initialize it to 5000 and increment it by 2

                  // as you create a new object

Checkup class has at least the following private attributes:

   string checkupDate;   

   double height;    

// in feet

   double weight;   

// in pounds

   int cholesterol;   

// total cholesterol

   int hdlCholesterol;   

// HDL cholesterol

   int triglycerides;   

// Triglycerides concentration

   int glucose;       

// glucose level

   string bloodPressure;   

// blood pressure

For each class, you need to write the following: an appropriate constructor, set and get functions as needed, and print functions to print the values of the attributes on the screen. The main member functions for the HealthRecords class are summarized below.

void HealthRecords::createNewPatient (string fName, string lName, long pSSN, char gender, string birthDate);

This function creates a new Patient object by calling the appropriate constructor. You should validate the given patient’s data before creating a new object. You should not create a new object if pSSN matches an existing patient’s SSN; just print an error message. Otherwise, you should create an object and add it to the patientsRecords vector and display a message that the patient object was successfully added.

Note that patientCheckups vector is initially empty. It is updated in addPatientCheckup method.

void HealthRecords::printAllPatients();

This function prints basic information about all patients in the patientsRecords vector. For each patient, you should print the following information: patient’s account number, first name, last name, gender, date of birth. If there are no patients, you should print an appropriate error message.

void HealthRecords::addPatientCheckup (long pNum, string cDate, double pHeight, double pWeight, double pCholesterol, double pHDL, double pTriglyceride, double pGlucose, double pBloodPressure);

This function creates a Checkup object and adds it to the patient’s list of checkups, that is, to the vector of patientCheckups for the patient account whose number is pNum. You need to ensure that patient account number is valid before adding the checkup to the patientCheckups vector. You should also display a message that the checkup entry is successfully added. Otherwise, you should not add any object to the vector and should print appropriate error messages.

void HealthRecords::printPatientCheckupSummary(long pNum, string sDate);

This function prints a detailed individual checkup report from a patient’s profile. You should first search for the patient whose account number is pNum and specifically for the checkup held on sDate. If no such entry is found, you should print an appropriate message. If an entry is found, you should print a detailed summary of that checkup along with medical warnings to the patient. This includes displaying personal information, test results and final notes to patient.

Personal information includes the patient’s name, age in years (calculated), gender, and date of birth.

Test results include some measured metrics and calculated metrics. Measured ones are total Cholesterol, HDL cholesterol, triglycerides, Glucose, and blood pressure, Calculated test results are LDL cholesterol level, total cholesterol to HDL cholesterol ratio, and Body Mass Index (BMI). These may be obtained as follows:

LDL cholesterol level (calculated) is obtained by dividing triglyceride concentrations by 5, subtracting it and the HDL cholesterol from the total cholesterol level.

Cholesterol/HDL ratio (calculated) is obtained by dividing the total cholesterol level by the HDL cholesterol level.

Body Mass Index (calculated) is obtained by multiplying the weight in pounds by 703, then dividing by height in inches squared.

Note: you need to write member functions in the Checkup class to calculate each one of these (calculated) metrics.

Final notes to the patient summarize potential risks if any. Normal reference ranges of each metric are shown below:

----------------------------------------------------------------

Total Cholesterol (Reference Range: 125-199mg/dL)

HDL Cholesterol (Reference Range: > or = 40 mg/dL)

Triglycerides (Reference Range: < 150 mg/dL)

LDL Cholesterol (Reference Range: < 130 mg/dL )

Cholesterol/HDL Ratio (Reference Range: < or = 5.0)

Glucose (Reference Range: 65-99 mg/dL)

Blood Pressure (Reference Range: < 120/80 mmHg)

Body Mass Index (Reference Range: 18.5-24.9)

---------------------------------------------------------------

The first six results are indicators of the heart health and heart disease risks. Results falling outside reference ranges are associated with “a high risk of coronary heart disease”.   

A normal value for Blood Pressure is < 120/80mmHg. If either the top number or the bottom number is above the specified range, the patient may have “hypertension”.

The BMI is an indication of body total fat. Target values are between 18.5 and 24.9. A BMI of 25 or above is linked to an “overweight with increased risk for health conditions such as heart disease, stroke…” . A BMI of less than 18.5 is considered “underweight with increased risk of electrolyte imbalances and osteoporosis”.

For example,

printPatientCheckupSummary 5004 10/22/2016…

Amelia Perez

Born on 12/05/1983, Female

32 years old, 5’1”, 157 pounds

                     10/22/2016

----------------------------------------------------------------

   Total Cholesterol          210

(Reference Range: 125-199mg/dL)

   HDL Cholesterol          68

(Reference Range: > or = 40 mg/dL)

   Triglycerides             135   

(Reference Range: < 150 mg/dL)

   LDL Cholesterol          115

(Reference Range: < 130 mg/dL)

   Cholesterol/HDL Ratio       3.09   

(Reference Range: < or = 5.0)

   Glucose               84         

(Reference Range: 65-99 mg/dL)

   Blood Pressure          99/50

(Reference Range: < 120/80 mmHg)

   Body Mass Index            29.47

(Reference Range: 18.5-24.9)

--------------------------------------------------------------- Notes to patient:

- Is Overweight with increased risk for health conditions such as heart disease, stroke…

---------------------------------------------------------------

void HealthRecords::printPatientHistory(long pNum);

This function prints the medical history of a specific patient whose patient account number is pNum. This includes printing a patient’s general information followed by a medical summary report. General information includes the patient’s first name, last name, gender, and date of birth. The medical report includes a table summarizing all the patient’s test results. For example:

Amelia Perez

Born on 12/05/1983, Female

                     10/2015    10/2016    10/2017

---------------------------------------------------------------------

   Total Cholesterol          188    210    182

(Reference Range: 125-199mg/dL)

   HDL Cholesterol          58    68    48

(Reference Range: > or = 40 mg/dL)

   Triglycerides             58    135    70

(Reference Range: < 150 mg/dL)

   LDL Cholesterol            118    115    120

(Reference Range: < 130 mg/dL)

   Cholesterol/HDL Ratio       3.24    3.09    3.79

(Reference Range: < or = 5.0)

   Glucose               89    84    88

(Reference Range: 65-99 mg/dL)

   Blood Pressure          99/53    99/50    99/56

(Reference Range: < 120/80 mmHg)

   Body Mass Index            28.15    29.47    31.53

(Reference Range: 18.5-24.9)

---------------------------------------------------------------------

void HealthRecords::processTransactionFile(string fileName);

This function opens the transaction file and processes its lines one by one. If the file could not be opened, you should print appropriate error message.

Note: Any member function that does not modify the attributes must be made constant.

After you design your classes (make sure to break up your classes into .cpp and .h files), write a main program that instantiates an object of type HealthRecords and calls a method to read a transaction file and process its commands. Your main should look like this:

int main()

{

   HealthRecords hr;

   hr.processTransactionFile("HW2.txt");

   return 0;

}

The transaction file contains several commands and corresponding values. The commands and their formats are:

CreateNewPatient    fName     lName pSSN pGender pBirthDate

AddPatientCheckup pNum cDate pHeight pWeight pCholesterol pHDL pTriglyceride pGlucose pBloodPressure

PrintAllPatients

PrintPatientCheckupSummary pNum cDate

PrintPatientHistory pNum

ProcessTransactionFile    fileName

A sample transaction file is shown below. You may use it to test your code:

CreateNewPatient Joe Garcia 432345673 M 11/10/1979

CreateNewPatient Suzy Walter 876523067 F 01/01/2010

CreateNewPatient Amelia Perez 876007654 F 12/05/1983

CreateNewPatient Tim Ducrest 123282345 M 01/12/2000

CreateNewPatient Amelia Perez 876007654 F 12/05/1983

CreateNewPatient Suzy Walter 987667654 F 09/20/1965

PrintAllPatients

AddPatientCheckup 5000 10/10/2015 5.8 210 160 33 178 88 123/78

AddPatientCheckup 5000 09/29/2016 5.8 215 165 29 312 91 129/86

AddPatientCheckup 5002 11/06/2016 4.1 70 180 69 120 80 101/78

AddPatientCheckup 5002 04/10/2017 4.2 75 198 65 120 81 100/76

AddPatientCheckup 5004 11/10/2015 5.1 150 188 58 58 89 99/53

AddPatientCheckup 5004 10/22/2016 5.1 157 210 68 135 84 99/50

AddPatientCheckup 5004 11/06/2017 5.1 168 182 48 70 88 99/56

AddPatientCheckup 5005 05/11/2017 5.2 165 180 49 70 88 100/56

AddPatientCheckup 5006 02/04/2017 5.9 170 202 36 301 90 126/87 AddPatientCheckup 5008 08/18/2017 5.4 180 165 42 200 105 105/76

PrintPatientHistory 5000

PrintPatientHistory 5002

PrintPatientHistory 5004

PrintPatientHistory 5006

PrintPatientHistory 5008

PrintPatientHistory 5010

PrintPatientCheckupSummary 5000 09/29/2016

PrintPatientCheckupSummary 5002 11/06/2016

PrintPatientCheckupSummary 5002 09/29/2017

PrintPatientCheckupSummary 5004 10/22/2016

PrintPatientCheckupSummary 5008 08/18/2017

   string checkupDate;   

   double height;    

// in feet

   double weight;   

// in pounds

   int cholesterol;   

// total cholesterol

   int hdlCholesterol;   

// HDL cholesterol

   int triglycerides;   

// Triglycerides concentration

   int glucose;       

// glucose level

   string bloodPressure;   

// blood pressure

Explanation / Answer

class HealthProfile
{
struct birth
{
int month, day, year;
};

struct Patient
{
string Fname;
string Lname;
char gender;
birth b; //-| Struct previously defined data type
float inches, weight;
};

public:
//-| Accessor Functions
string get_Fname();
string get_Lname();
char get_gender();
float get_height();
float get_weight();
birth get_bday();
birth get_bmonth();
birth get_byear();

//-| Calculation Functions
int person_age(); // Calculate Person's age;
int max_heartrate(int age); // Calculate Max Heart Rate
float body_mass(); // calculate BMI
int targetheartrate(int heart_rate);
//-| Mutator Functions

void set_Fname(string namef);
void set_Lname(string namel);
void set_gender(char a);
void set_height(float inches);
void set_weight(float weights);
void set_bday(int days);
void set_bmonth(int months);
void set_byear(int years);

};

#include "Fields_HealthProfile.cpp"

my implementation file:

//-| Accessor Functions

string get_Fname()
{
return Patient.Fname;
}
  
string get_Lname()
{
return Patient.Lname;
}

char get_gender()
{
return Patient.gender;
}

float get_height()
{
return Patient.inches;
}

float get_weight()
{
return Patient.weight;
}

birth get_bday()
{
return Patient.b.day;
}

birth get_bmonth();
{
return Patient.b.month;
}

birth get_byear();
{
return Patient.b.year;
}

//-| Mutator Functions

void set_Fname(string namef)
{
Patient.Fname = namef;
}
void set_Lname(string namel)
{
Patient.Lname = namel;
}
void set_gender(char a)
{
Patient.gender = a;
}
void set_height(float inches)
{
Patient.inches = inches;
}
void set_weight(float weights
{
Patient.weight = weights;
}
void set_bday(int days)
{
Patient.b.day = days;
}
void set_bmonth(int months)
{
Patient.b.month = months;
}
void set_byear(int years)
{
Patient.b.year = years;
}

//-| Calculation Functions

int person_age() // Calculate Person's age;
{
int month;
int day;
int year;

cout << "What is the month (in form ex. 01) ?" << endl;
cin >> month;

cout << "What is the day (in form ex. 05) ?" << endl;
cin >> day;

cout << "What is the year (in form ex. 1992) ?" << endl;
cin >> year;

return Patient.b.year - year;
}

int maxheartrate(int age) // Calculate Max Heart Rate
{
return 220 - age;
}

int targetheartrate(int heart_rate) // Calculate Target Heart Rate 50 - 85% of max
{
int target;
target = heart_rate*.6;

return target;
}

float body_mass() // calculate BMI
{

float mass;
float height2;
mass = weight*730;
height2 = Patient.inches * Patient.inches;
mass = mass/height2;

return mass;

}

my main program

#include <iostream>
#include <iomanip>
#include <string>
#include "Fields_HealthProfile.h"

using namespace std;

int main()
{

string a;
char b;
int c;
float e;

//-| Collecting Person's Name

cout << "Enter the person's First Name" << endl;
cin >> a;
set_Fname(a);

cout << "Enter the person's Last Name" << endl;
cin >> a;
set_Lname(a);

//-| Collecting Male or Female
cout << "Enter the person's Gender" << endl;
cin >> b;
set_gender(b);

//-| Collectiong Birth Information
cout << "What is the birth month (in form ex. 01) ?" << endl;
cin >> c;
set_bmonth(c);

cout << "What is the birth day (in form ex. 05) ?" << endl;
cin >> c;
set_bday(c);

cout << "What is the birth year (in form ex. 1992) ?" << endl;
cin >> c;
set_byear(c);

//-| Collecting Height and Weight

cout << "What is the Person's Height in inches?" << endl;
cin >> e;
set_height(e);

cout << "What is the Person's Weight in pounds?" << endl;
cin >> e;
set_weight(e);

//-| Calculating and Printing: Age, BMI, Max Heart Rate, and Target Heart Rate.

int age;

age = person_age();

float bodymass;
bodymass = body_mass();

int mheart;
int theart;

mheart = max_heartrate(age);
theart = targetheartrate(mheart);

cout << "The Person's Age is: " << age << " their BMI is: " << bodymass << " their Maximum Heart Rate is: " << mheart << " and their Target Heart Rate is: " << theart << '.' << endl;

return 0;

}
Edit & Run

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote