Sunday, August 20, 2017

Programming Challenge 13.4 [9E] - Patient Charges

Example Files: Patient.h
                          Procedure.h
                          PatientCharges.cpp
                          PatientChargesDemo.cpp

Patient.h


/* Patient.h - Specification file for the Patient class */

#ifndef PATIENT_H
#define PATIENT_H

#include <string>

using std::string;

class Patient
{
    private:
        string name;                    // Name of the patient
        string address;                // Patient's address
        string phoneNumber;            // Patient's telephone number
        string emcName;                // Name of the emergency contact person
        string emcPhoneNumber;        // Telephone number of the emergency contact person   

    public:
        // Constructor accepting arguments for all Procedure members
        Patient(string pN, string pAddr, string pPhone, string emcN, string emcPhone)
        {
            name = pN;
            address = pAddr;
            phoneNumber = pPhone;
            emcName = emcN;
            emcPhoneNumber = emcPhone;
        }

        // Destructor
        ~Patient()
        {}
       
        // Mutators
        void setName(string pN)
        { name = pN; }

        void setAddress(string pAddr)
        { address = pAddr; }
       
        void setPhoneNumber(string pPhone)
        { phoneNumber = pPhone; }

        void setEMCName(string emcN)
        { emcName = emcN; }

        void setEMCPhoneNumber(string emcPhone)
        { emcPhoneNumber = emcPhone; }

        // Accessors
        string getName() const
        { return name; }

        string getAddress() const
        { return address; }
       
        string getPhoneNumber() const
        { return phoneNumber; }

        string getEMCName() const
        { return emcName; }

        string getEMCPhoneNumber() const
        { return emcPhoneNumber; }

        void display() const;
};
#endif

Procedure.h


/* Procedure.h - Specification file for the Procedure class */

#ifndef PROCEDURE_H
#define PROCEDURE_H

#include <string>
#include <iostream>

using std::string;

class Procedure
{
    private:
        string procedureName;            // Name of the procedure
        string dateToday;                    // Today's date
        string practitionerName;        // Name of the practitioner
        double charge;                        // Holding the charges for each procedure
        double total;                        // Holding the total charges

    public:
        // Default constructor
        Procedure()       
        {   
            procedureName = "";
            dateToday = "";
            practitionerName = "";
            charge = 0.0;
            total = 0.0;
        }

        // Destructor
        ~Procedure()
        {}

        // Constructor accepting arguments for all Procedure members
        Procedure(string procName, string dateT, string practName, double procChrg)   
        {
            procedureName = procName;
            dateToday = dateT;
            practitionerName = practName;
            charge = procChrg;
            total = procChrg;
        }

        // Mutators
        void setProcedureName(string proc)
        { procedureName = proc; }

        void setDateToday(string dateT)
        { dateToday = dateT; }

        void setPractitionerName(string practName)
        { practitionerName = practName; }

        void setTotal(double chrg)
        { total += chrg; }

        // Accessors
        string getProcedureName() const
        { return procedureName; }

        string getDateToday() const
        { return dateToday; }

        string getPractitionerName() const
        { return practitionerName; }

        double getCharge() const
        { return charge; }

        double getTotal() const
        { return total; }

        void display() const;
        void displayTotal() const;

};
#endif

PatientCharges.cpp


/* PatientCharges.cpp - Implementation file for the Patient and Procedure
    class files. */

#include "Procedure.h"
#include "Patient.h"

#include <string>
#include <iomanip>

using std::cout;
using std::fixed;
using std::setprecision;
using std::showpoint;
using std::setw;

/* **********************************************************
                Patient::display
    This function displays information about a patient.
   ********************************************************** */

void Patient::display() const
{
         cout << "\n\nPATIENT INFORMATION\n\n"
              << "Patient Name: "     << setw(15) << getName()               << "\n"
                 << "Address: "          << setw(45) << getAddress()           << "\n"
                 << "Phone Number: "     << setw(13) << getPhoneNumber()    << "\n"
                 << "EMC Contact: "         << setw(15) << getEMCName()           << "\n"
                 << "EMC Phone #: "         << setw(14) << getEMCPhoneNumber() << "\n\n";
}

/* **********************************************************
                Procedure::displayProcedures
    This function displays information about the procedures
    performed on a patient, the name of the procedure, the
    date it was performed on, the practitioner performing it,
    and the charge for that procedure.
   ********************************************************** */

void Procedure::display() const
{
    cout << setw(16) << "Procedure Name: " << getProcedureName()        << "\n"
          << setw(16) << "Date: "               << getDateToday()            << "\n"
          << setw(16) << "Practitioner: "    << getPractitionerName() << "\n"
          << setw(18) << "Charge: $ "           << getCharge()               << "\n\n";
}

/* **********************************************************
                Procedure::displayTotal
    This function displays the total charges.
   ********************************************************** */

void Procedure::displayTotal() const
{
    cout << setw(18) << "Total Charge: $ " << total;
}

PatientChargesDemo.cpp


/* PatientChargesDemo.cpp - This program demonstrates the Patient and Procedure
    classes.    */

#include <string>
#include <iostream>
#include <iomanip>
#include "Patient.h"
#include "Procedure.h"

using std::cout;
using std::cin;
using std::setw;

void calcCharges(Procedure &, const Procedure *, const int);
void displayInfo(const Procedure *, const int);

int main()
{
    const int NUM_PROCEDURES = 3;

    Procedure charges;

    // Patient object initialized with
    Patient patientInfo("Lo Wen, Allen", "22 McKenzie Drive, Upper King, WA 6630",
                              "1244-124565", "Leona, Allen", "2484-241565");

    // Array of three Procedure objects
    Procedure procedures[NUM_PROCEDURES] = { { "Physical Exam", "17.08.2017", "Dr. Irvine", 250.00 },
                                                          { "X-Ray", "17.08.2017", "Dr. Jones", 500.00 },
                                                          { "Blood Test", "17.08.2017", "Dr. Smith", 200.00 } };
   
    cout << "Mt. RAKUTEI HOSPITAL - PATIENT BILLING SYSTEM\n\n";

    patientInfo.display();
    calcCharges(charges, procedures, NUM_PROCEDURES);
    displayInfo(procedures, NUM_PROCEDURES);
    charges.displayTotal();

    cin.ignore();
    return 0;
}

/* **********************************************************
    calcCharges (accepts a Procedure object passed to it by
                     reference, a const Procedure array object,
                     and an integer holding the total number of
                     charges)
    It calculates the total patient charges.
   ********************************************************** */

void calcCharges(Procedure &charges, const Procedure *procedures, const int NUM_CHARGES)
{
    for (int i = 0; i < NUM_CHARGES; i++)
    {
        charges.setTotal(procedures[i].getCharge());               
    }
}

/* **********************************************************
    displayInfo (accepts a const Procedure array object, and
    an integer value holding the total number of procedures)
    It displays all information about the procedures performed
    on the patient.
   ********************************************************** */

void displayInfo(const Procedure *procedures, const int NUM_PROCEDURES)
{
    cout << "MEDICAL PROCEDURES\n\n";
    cout << std::setprecision(2) << std::showpoint << std::fixed;
    for (int i = 0; i < NUM_PROCEDURES; i++)
    {
        procedures[i].display();
    }
}

Example Output:



4 comments:

  1. I have being on blog Sites for a while now and today I felt like I should share my story because I was a victim too. I had HIV for 6 years and i never thought I would ever get a cure I had and this made it impossible for me to get married to the man I was supposed to get married to even after 2 years of relationship he broke up with me when he finds out I was HIV positive. So I got to know about Dr. Itua on Blog Site who treated someone and the person shared a story of how she got a cured and let her contact details, I contacted Dr. Itua and he actually confirmed it and I decided to give a try too and use his herbal medicine that was how my burden ended completely. My son will be 2 soon and I am grateful to God and thankful to his medicine too.Dr Itua Can As Well Cure The Following Disease…Alzheimer’s disease,Bechet’s disease,Crohn’s disease,Parkinson's disease,Schizophrenia,Lung Cancer,Breast Cancer,Colo-Rectal Cancer,Blood Cancer,Prostate Cancer,siva.Fatal Familial Insomnia Factor V Leiden Mutation ,Epilepsy Dupuytren's disease,Desmoplastic small-round-cell tumor Diabetes ,Coeliac disease,Creutzfeldt–Jakob disease,Cerebral Amyloid Angiopathy, Ataxia,Arthritis,Amyotrophic Lateral Scoliosis,Fibromyalgia,Fluoroquinolone Toxicity
    Syndrome Fibrodysplasia Ossificans ProgresSclerosis,Seizures,Alzheimer's disease,Adrenocortical carcinoma.Asthma,Allergic diseases.Hiv_ Aids,Herpe ,Copd,Glaucoma., Cataracts,Macular degeneration,Cardiovascular disease,Lung disease.Enlarged prostate,Osteoporosis.Alzheimer's disease,
    Dementia.Lupus.
    ,Cushing’s disease,Heart failure,Multiple Sclerosis,Hypertension,Colo_Rectal Cancer,Lyme Disease,Blood Cancer,Brain Cancer,Breast Cancer,Lung Cancer,Kidney Cancer, HIV, Herpes,Hepatitis B, Liver Inflammatory,Diabetes,Fibroid, Get Your Ex Back, If you have (A just reach him on drituaherbalcenter@gmail.com Or Whatsapp Number.+2348149277967)He can also advise you on how to handle some marital's issues. He's a good man.

    ReplyDelete
  2. All thanks to this great herbal doctor who cured me from (LUPUS DISEASE) his name is dr imoloa.  I suffered lupus disease for over 8 years with pains like: joints, Skin rash,  Pain in the chest,  swollen joints and many more.  The anti-inflammatory drugs couldn’t cure me, until I read about his recommendation. 2 months ago, I contacted him through his email address. drimolaherbalmademedicine@gmail.com . and he sent me the herbal treatment through DHL courier service and he instructed me on how to drink it for good two weeks. after then,  And I was confirmed cured and free at the hospital after taken his powerful herbal medications You too can be cured with it if interested, he also uses his powerful herbal healing medicine to cure disease like: parkison disease, vaginal cancer, epilepsy,  Anxiety Disorders, Autoimmune Disease,  Back Pain,  Back Sprain,   Bipolar Disorder,  Brain Tumour,  Malignant,  Bruxism, Bulimia,  Cervical Disk Disease, cardiovascular disease, Neoplasms,  chronic respiratory disease,  mental and behavioural disorder,  Cystic  Fibrosis,  Hypertension, Diabetes, asthma,  Inflammatory autoimmune-mediated arthritis.  chronic kidney disease, inflammatory joint disease, back pain,  impotence,  feta  alcohol spectrum,  Dysthymic Disorder,   Eczema, skin cancer,  tuberculosis,  Chronic Fatigue Syndrome, constipation, inflammatory bowel  disease, bone cancer, lungs cancer,  mouth ulcer,  mouth cancer, body pain, fever, hepatitis A.B.C.,   syphilis,  diarrhea,  HIV/AIDS,  Huntington's Disease,  back acne,  Chronic renal failure,   addison disease,  Chronic Pain,   Crohn's  Disease,   Cystic Fibrosis,  Fibromyalgia,   Inflammatory Bowel Disease,  fungal  nail disease, Lyme Disease, Celia disease, Lymphoma, Major  Depression,  Malignant Melanoma,   Mania,  Melorheostosis,   Meniere's  Disease,  Mucopolysaccharidosis , Multiple Sclerosis,  Muscular  Dystrophy,  Rheumatoid Arthritis, Alzheimer's Disease, bring back relationship spell.      Contact him today  and get a permanent cure. contact him via... email- drimolaherbalmademedicine@gmail.com  /whatssapp-+2347081986098.
    website-www.drimolaherbalmademedicine.wordpress.com

    ReplyDelete
  3. Rhonda S.’s COPD made her feel short of breath and like she was constantly dragging. While her inhalers helped some, she just didn’t feel like herself anymore.
    After having life-threatening pneumonia, she knew something had to change. A friend of hers mentioned multivitamin herbal formula restoration treatment, so Rhonda did
    some research and decided to receive treatment at the multivitamin herbal cure. “I started to feel better almost right away,” Rhonda said.
    And, along with feeling better, she began to do things she couldn’t do before treatment. Now, Rhonda can take showers, work in her flower garden, and she enjoys having more energy. It’s with a great deal of hope, Rhonda says, “I feel more like myself.”
    Like Rhonda, you can breathe easier and bring normal life back within reach. If you or someone you love has a chronic lung disease and would like more information, contact us today by calling (+1 (956) 758-7882 to visit their website multivitamincare .org

    ReplyDelete
  4. Natural herbs have cured so many illnesses that drugs and injections can't cure. I've seen the great importance of natural herbs and the wonderful work they have done in people's lives. i read people's testimonies online on how they were cured of Herpes, Hpv HIV/AIDS & STDs, Diabetics , Gonorrhea, Hepatitis, Arthritics , etc. by herbal medicine, so i decided to contact the doctor because i know nature has the power to heal anything. I was diagnosed with Herpes for the past years but Dr Chike cured me with his herbs and I referred my aunt and her husband to him immediately because they were both suffering from herpes but to God be the glory, they were cured too .I know it is hard to believe but I am a living testimony. There is no harm trying herbs. Contact Dr on Whats-App . +233502715551. text/call via: +1 (719) 629 0982 , or you can also contact through his Facebook Page @ Dr Chike Herbal Remedy.

    ReplyDelete