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

Design various classes and write a program to computerize the billing system of

ID: 3790921 • Letter: D

Question

Design various classes and write a program to computerize the billing system of a hospital. Design the class doctor Type, inherited from the class personType, defined in Chapter 10, with an additional data member to store a doctor's specialty. Add appropriate constructors and member functions to initialize, access, and manipulate the data members. Design the class bill Type with data members to store a patient's ID and a patient's hospital charges, such as pharmacy charges for medicine, doctor's fee, and room charges. Add appropriate constructors and member functions to initialize, access, and manipulate the data members. Design the class patientType, inherited from the class personType, defined in Chapter 10, with additional data members to store a patient's ID, age, date of birth, attending physician's name, the date when the patient was admitted in the hospital, and the date when the patient was discharged from the hospital. (Use the class dateType to store the date of birth, admit date, discharge date, and the class doctorType to store the attending physician's name.) Add appropriate constructors and member functions to initialize, access, and manipulate the data members. Write a program to test your classes.

Explanation / Answer

Please find the code for the given problem with required classes

//billType.cpp
#include "billType.h"

billType::billType(int ID, double Med, double pDrF, double room_Charge)
{
   PtID = ID;
   MedChg = Med;
   DrF = pDrF;
   RmChg = room_Charge;
}

void billType::setMedChg(double Med)
{
   MedChg = Med;
}

double billType::getMedChg() const
{
   return MedChg;
}

void billType::setDrF(double pDrF)
{
   DrF = pDrF;
}

double billType::getDrF() const
{
   return DrF;
}

void billType::setRmChg(double pRmChg)
{
   RmChg = pRmChg;
}

double billType::getRmChg() const
{
   return RmChg;
}

//billType.h
#ifndef billType_H
#define billType_H
#include <iostream>
#include <string>

using namespace std;

class billType
{
private :
   int PtID;
   double MedChg;
   double DrF;
   double RmChg;

public:
   billType(int PtID = 0, double MedChg = 0, double DrF = 0, double RmChg = 0);
   void setMedChg(double MedChg);
   double getMedChg() const;
   void setDrF(double DrF);
   double getDrF() const;
   void setRmChg(double RmChg);
   double getRmChg() const;
};

#endif billType_H

//dateType.cpp
#include <iostream>
#include "dateType.h"

using namespace std;

void dateType::setDate(int Month, int Day, int Year)
{
   nMnth = Month;
   nDay = Day;
   nYr = Year;
}

int dateType::getDay() const
{
   return nDay;
}

int dateType::getMonth() const
{
   return nMnth;
}

int dateType::getYear() const
{
   return nYr;
}

void dateType::printDate() const
{
   cout << nMnth << "-" << nDay << "-" << nYr;
}

//Constructor with parameters
dateType::dateType(int Month, int Day, int Year)
{
   nMnth = Month;
   nDay = Day;
   nYr = Year;
}

//dateType.h
#ifndef dateType_H
#define dateType_H

class dateType
{
public:
   void setDate(int Month, int Day, int Year);
  
   int getDay() const;
  
   int getMonth() const;
  
   int getYear() const;
  
   void printDate() const;
  
   dateType(int Month = 1, int Day = 1, int Year = 1900);

private:
   int nMnth;
   int nDay;
   int nYr;
};

#endif

//doctorType.cpp
#include "doctorType.h"

doctorType::doctorType(string First, string Last ,string pDrSpec)
{
   setName(First,Last);
   Spec = pDrSpec;
}

void doctorType::setSpec(string pDrSpec)
{
   Spec = pDrSpec;
}

string doctorType::getSpec()
{
   return Spec;
}

//doctorType.h
#ifndef doctorType_H
#define doctorType_H

#include<iostream>
#include<string>
#include "personType.h"
using namespace std;

//inherits from personType class
class doctorType : public personType
{
private :
   string Spec;
public:
  
   //public member function of doctor class
   doctorType(string First = "", string Last = "", string Spec = "");
   void setSpec(string Spec) ;
   string getSpec() ;
};

#endif doctorType_H

//main.cpp
#include<iostream>
//Include header files
#include "doctorType.h"
#include "patientType.h"
#include "dateType.h"
#include "billType.h"
using namespace std;
int main()
{
   //create an object of class
   doctorType doctor("Bob", "Evans", "Endocrinologist");
   cout << "**********************************" << endl;
   cout << "**        Doctor Details        **" << endl;
   cout << "**********************************" << endl;
   cout << "** Dr. Name: " << doctor.getfName() << " " << doctor.getlName() << endl;
   cout << "** Specialty: " << doctor.getSpec() << endl;
   cout << "**********************************" << endl;
   cout << endl;
  
   //Create three dateType objects for date of birth,
   //admit date and dicahrage date
   dateType dtBth(10,12,1954);
   dateType admtDt(6,25,2015);
   dateType DcDt(7,1,2015);
  
   patientType patient("Don","Johnson", 12345, 60, dtBth, admtDt, DcDt, doctor);
   cout << "**********************************" << endl;
   cout << "**       Patient Details        **" << endl;
   cout << "**********************************" << endl;
   cout << "** Patient Name: " << patient.getfName() << " " << patient.getlName() << endl;
   cout << "** Patient ID: " << patient.getPtID() << endl;
   cout << "** Age: " << patient.getAge() << endl;
   cout << "** Date Of Birth: ";
   patient.getDoB().printDate();
   cout << endl;
   cout << "**********************************" << endl;
   cout << endl;

   cout << "**********************************" << endl;
   cout << "**        Visit Details         **" << endl;
   cout << "**********************************" << endl;
   cout << "** Date of Admission: ";
   patient.getAdmtDt().printDate();
   cout << " ** Date of Discharge: ";
   patient.getDcDt().printDate();
   cout << " ** Doctor Name: "<< patient.getPcNm() << endl;
   cout << "**********************************" << endl;
   cout << endl;

   //create an instance of billType
   billType patientBill(10345,14900,1400,400);

   cout << "**********************************" << endl;
   cout << "**       Billing Details        **" << endl;
   cout << "**********************************" << endl;
   cout << "** Medicine Cost: " << patientBill.getMedChg() << endl;
   cout << "** Doctor Fee: " << patientBill.getDrF() << endl;
   cout << "** Room Charges: " << patientBill.getRmChg() << endl;
   cout << "** Total pay: " << patientBill.getMedChg() + patientBill.getDrF() + patientBill.getRmChg() << endl;
   cout << "**********************************" << endl;
  
   system("pause");
   return 0;
}

//patientType.cpp
#include <iostream>
#include "patientType.h"

patientType::patientType(string First, string Last, int ID, int PtAge, dateType DoB, dateType pAdmtDt, dateType pDcDt, doctorType pDr)
{
   setName(First,Last);
   PtID = ID;
   Age = PtAge;
   dtBth = DoB;
   admtDt = pAdmtDt;
   DcDt = pDcDt;
   Dr = pDr;
}

void patientType::setPtID(int ID)
{
   PtID = ID;
}

void patientType::setAge(int pAge)
{
   Age = pAge;
}

void patientType::setDoB(dateType DoB)
{
   dtBth = DoB;
}

void patientType::setAdmtDt(dateType pAdmtDt)
{
   admtDt = pAdmtDt;
}

void patientType::setDcDt(dateType pDcDt)
{
   DcDt = pDcDt;
}

void patientType::setPcNm(doctorType pDr)
{
   Dr = pDr;
}

int patientType::getPtID()
{
   return PtID;
}

int patientType::getAge()
{
   return Age;
}

dateType patientType::getDoB()
{
   return dtBth;
}

dateType patientType::getAdmtDt()
{
   return admtDt;
}

dateType patientType::getDcDt()
{
   return DcDt;
}

string patientType::getPcNm()
{
   return Dr.getfName().append(" " + Dr.getlName());
}

//patientType.h
#ifndef patientType_H
#define patientType_H
#include<iostream>
#include<string>
#include "personType.h"
#include "dateType.h"
#include "doctorType.h"

using namespace std;

class patientType :public personType
{
private:
   int PtID;
   int Age;
   dateType dtBth;
   dateType admtDt;
   dateType DcDt;
   doctorType Dr;

public:
   patientType(string First, string Last, int PtID, int Age, dateType dtBth, dateType admtDt, dateType DcDt, doctorType Dr);
  
   void setPtID(int ID);
   int getPtID();
  
   void setAge(int Age);
   int getAge();
  
   void setDoB(dateType DoB);
   dateType getDoB();
  
   void setAdmtDt(dateType AdmtDt);
   dateType getAdmtDt();
  
   void setDcDt(dateType DcDt);
   dateType getDcDt();
  
   void setPcNm(doctorType Dr);
   string getPcNm();
};

#endif patientType_H

//personType.cpp
#include <iostream>
#include <string>
#include "personType.h"

using namespace std;

void personType::print() const
{
   cout << fName << " " << lName;
}

void personType::setName(string First, string Last)
{
   fName = First;
   lName = Last;
}

string personType::getfName() const
{
   return fName;
}

string personType::getlName() const
{
   return lName;
}

personType::personType(string First, string Last)
{
   fName = First;
   lName = Last;
}

//personType.h
#ifndef personType_H
#define personType_H
#include <string>

using namespace std;

class personType
{
public:
   void print() const;

   void setName(string First, string Last);

   string getfName() const;

   string getlName() const;

   personType(string First = "", string Last = "");

protected:
   string fName;
   string lName;
};

#endif personType_H

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