#include <iostream>
#include <string>
#include "patientType.h"
#include "billType.h"
using namespace std;
int main()
{
patientType newPatient;
billType bill;
string str1, str2, str3;
cout << "Enter patient's ID: ";
cin >> str1;
cout << endl;
newPatient.setID(str1);
bill.setID(str1);
cout <<"Enter patient's first name: ";
cin >> str1;
cout << endl;
cout << "Enter patient's last name: ";
cin >> str2;
cout << endl;
newPatient.setName(str1, str2);
cout <<"Enter doctor's first name: ";
cin >> str1;
cout << endl;
cout << "Enter doctor's last name: ";
cin >> str2;
cout << endl;
newPatient.setDoctorName(str1, str2);
cout << "Enter doctor's speciality: ";
cin >> str1;
cout << endl;
newPatient.setDoctorSpl(str1);
newPatient.setAdmDate(4, 15, 2009);
newPatient.setDisDate(4, 21, 2009);
bill.setPharmacyCharges(245.50);
bill.setRoomRent(2500);
bill.setDoctorFee(3500.38);
newPatient.print();
bill.printBill();
// Added Holdscreen for Command Line Compilers
char holdscr; // This character and section is to hold screen open
cout << "\n\n\tPress a character and Enter to exit program. ";
cin >> holdscr;
return 0;
}
#ifndef H_BillType
#define H_BillType
#include <string>
#include "doctorType.h"
#include "personType.h"
#include "dateType.h"
using namespace std;
class billType
{
public:
void setRoomRent(double charges); //Debug
void printBill() const;
void setInfo(string id = "", double phCharges = 0, double rRent = 0,
double docFee = 0);
void setID(string id);
string getID();
void setPharmacyCharges(double charges = 0);
double getPharmacyCharges();
void updatePharmacyCharges(double charges = 0);
double getRoomRent();
void updateRoomRent(double charges = 0);
void setDoctorFee(double charges = 0);
double getDoctorFee();
void updateDoctorFee(double charges = 0);
double billingAmount();
billType(string id = "", double phCharges = 0, double rRent = 0, double docFee = 0);
private:
string ID;
double pharmacyCharges;
double roomRent;
double doctorFee;
};
#endif
#include <iostream>
#include <string>
#include <iomanip>
#include "billType.h"
using namespace std;
void billType::printBill() const
{
cout << fixed << showpoint;
cout << "Pharmacy Charges: $" << pharmacyCharges << endl;
cout << "Room Charges: $" << roomRent << endl;
cout << "Doctor's Fees: $" << doctorFee << endl;
cout << "______________________________ " << endl;
cout << "Total Charges: $" << pharmacyCharges + roomRent + doctorFee << endl; //Debug
}
double billType::billingAmount()
{
return pharmacyCharges + roomRent + doctorFee;
}
void billType::setInfo(string id, double phCharges, double rRent,
double docFee)
{
ID = id;
pharmacyCharges = phCharges;
roomRent = rRent;
doctorFee = docFee;
}
void billType::setID(string id)
{
ID = id;
}
string billType::getID()
{
return ID;
}
void doctorType::setSpeciality(string s) //Debug
{
speciality = s;
}
void billType::setPharmacyCharges(double charges)
{
pharmacyCharges = charges;
}
double billType::getPharmacyCharges()
{
return pharmacyCharges;
}
void billType::updatePharmacyCharges(double charges)
{
pharmacyCharges = pharmacyCharges + charges;
}
void billType::setRoomRent(double charges)
{
roomRent = charges;
}
double billType::getRoomRent()
{
return roomRent;
}
void billType::updateRoomRent(double charges)
{
roomRent = roomRent + charges;
}
void billType::setDoctorFee(double charges)
{
doctorFee = charges;
}
double billType::getDoctorFee()
{
return doctorFee;
}
void billType::updateDoctorFee(double charges)
{
doctorFee = doctorFee + charges;
}
billType::billType(string id, double phCharges, double rRent,
double docFee)
{
ID = id;
pharmacyCharges = phCharges;
roomRent = rRent;
doctorFee = docFee;
}
#ifndef dateType_H
#define dateType_H
class dateType
{
public:
void setDate(int month, int day, int year);
//Function to set the date.
//The member variables dMonth, dDay, and dYear are set
//according to the parameters.
//Postcondition: dMonth = month; dDay = day;
// dYear = year
int getDay() const;
//Function to return the day.
//Postcondition: The value of dDay is returned.
int getMonth() const;
//Function to return the month.
//Postcondition: The value of dMonth is returned.
int getYear() const;
//Function to return the year.
//Postcondition: The value of dYear is returned.
void printDate() const;
//Function to output the date in the form mm-dd-yyyy.
dateType(int month = 1, int day = 1, int year = 1900);
//Constructor to set the date
//The member variables dMonth, dDay, and dYear are set
//according to the parameters.
//Postcondition: dMonth = month; dDay = day; dYear = year;
// If no values are specified, the default
// values are used to initialize the member
// variables.
private:
int dMonth; //variable to store the month
int dDay; //variable to store the day
int dYear; //variable to store the year
};
#endif
//Implementation file date
#include <iostream>
#include "dateType.h"
using namespace std;
void dateType::setDate(int month, int day, int year)
{
dMonth = month;
dDay = day;
dYear = year;
}
int dateType::getDay() const
{
return dDay;
}
int dateType::getMonth() const
{
return dMonth;
}
int dateType::getYear() const
{
return dYear;
}
void dateType::printDate() const
{
cout << dMonth << "-" << dDay << "-" << dYear;
}
//Constructor with parameters
dateType::dateType(int month, int day, int year)
{
dMonth = month;
dDay = day;
dYear = year;
}
#ifndef H_doctorType
#define H_doctorType
#include <string>
#include "personType.h"
using namespace std;
class doctorType: public personType
{
public:
void print() const;
void setSpeciality(string spl);
string getSpeciality();
doctorType(string first = "", string last = "", string spl = "");
private:
string speciality;
};
#endif
#include <iostream>
#include <string>
#include "doctorType.h"
using namespace std;
void doctorType::print() const
{
personType::print();
cout << " " << speciality;
}
string doctorType::getSpeciality()
{
return speciality;
}
doctorType::doctorType(string first, string last, string spl)
:personType(first, last)
{
speciality = spl;
}
#ifndef H_patientType
#define H_patientType
#include <string>
#include "doctorType.h"
#include "personType.h"
#include "dateType.h"
using namespace std;
class patientType: public personType
{
public:
void print() const;
void setInfo(string id = "", string fName = "", string lName = "",
int bDay = 1, int bMth = 1, int bYear = 1900,
string docFrName = "", string docLaName = "", string docSpl = "",
int admDay = 1, int admMth = 1, int admYear = 1900,
int disChDay = 1, int disChMth = 1, int disChYear = 1900);
void setID(string id);
string getID();
void setBirthDate(int bDay = 1, int bMth = 1, int bYear = 1900);
int getBirthDay();
int getBirthMonth();
int getBirthYear();
void setDoctorName(string fName = "", string lName = "");
void setDoctorSpl(string spl = "");
string getDoctorFName();
string getDoctorLName();
string getDoctorSpl();
void setAdmDate(int admDay = 1, int admMth = 1, int admYear = 1900);
int getAdmDay();
int getAdmMonth();
int getAdmYear();
void setDisDate(int disDay = 1, int disMth = 1, int disYear = 1900);
int getDisDay();
int getDisMonth();
int getDisYear();
patientType(string id = "", string fName = "", string lName = "",
int bDay = 1, int bMth = 1, int bYear = 1900,
string docFrName = "", string docLaName = "", string docSpl = "",
int admDay = 1, int admMth = 1, int admYear = 1900,
int disChDay = 1, int disChMth = 1, int disChYear = 1900);
private:
string ID;
dateType dateOfBirth;
doctorType attendingPhysicain;
dateType admitDate;
dateType dischargeDate;
}
#endif
#include <iostream>
#include <string>
#include <iomanip>
#include "patientType.h"
using namespace std;
void patientType::print() const
{
cout << "Patient: ";
personType::print();
cout << endl;
cout << "Attending Physician: ";
attendingPhysicain.print();
cout << endl;
cout << "Admit Date: ";
admitDate.printDate();
cout << endl;
cout << "Discharge Date: ";
dischargeDate.printDate();
cout << endl << endl;
}
void patientType::setInfo(string id, string fName, string lName,
int bDay, int bMth, int bYear,
string docFrName,
string docLaName, string docSpl,
int admDay, int admMth, int admYear,
int disChDay, int disChMth, int disChYear)
{
ID = id;
setName(fName, lName);
dateOfBirth.setDate(bDay, bMth, bYear);
attendingPhysicain.setName(docFrName, docLaName);
attendingPhysicain.setSpeciality(docSpl);
admitDate.setDate(admDay, admMth, admYear);
dischargeDate.setDate(disChDay, disChMth, disChYear);
}
void patientType::setID(string id)
{
ID = id;
}
string patientType::getID()
{
return ID;
}
void patientType::setBirthDate(int bDay, int bMth, int bYear)
{
dateOfBirth.setDate(bDay, bMth, bYear);
}
int patientType::getBirthDay()
{
return dateOfBirth.getDay();
}
int patientType::getBirthMonth()
{
return dateOfBirth.getMonth();
}
int patientType::getBirthYear()
{
return dateOfBirth.getYear();
}
void patientType::setDoctorName(string fName, string lName)
{
attendingPhysicain.setName(fName, lName);
}
void patientType::setDoctorSpl(string spl)
{
attendingPhysicain.setSpeciality(spl);
}
string patientType::getDoctorFName()
{
return attendingPhysicain.getFirstName();
}
string patientType::getDoctorLName()
{
return attendingPhysicain.getLastName();
}
string patientType::getDoctorSpl()
{
return attendingPhysicain.getSpeciality();
}
void patientType::setAdmDate(int admDay, int admMth, int admYear)
{
admitDate.setDate(admDay, admMth, admYear);
}
int patientType::getAdmDay()
{
return admitDate.getDay();
}
int patientType::getAdmMonth()
{
return admitDate.getMonth();
}
int patientType::getAdmYear()
{
return admitDate.getYear();
}
void patientType::setDisDate(int disDay, int disMth, int disYear) //Debug
{
dischargeDate.setDate(disDay, disMth, disYear);
}
int patientType::getDisDay()
{
return dischargeDate.getDay();
}
int patientType::getDisMonth()
{
return dischargeDate.getMonth();
}
int patientType::getDisYear()
{
return dischargeDate.getYear();
}
patientType::patientType(string id, string fName, string lName,
int bDay, int bMth, int bYear,
string docFrName, string docLaName, string docSpl,
int admDay, int admMth, int admYear,
int disChDay, int disChMth, int disChYear)
: personType(fName, lName),
dateOfBirth(bDay, bMth, bYear),
attendingPhysicain(docFrName, docLaName, docSpl),
admitDate(admDay, admMth, admYear),
dischargeDate(disChDay, disChMth, disChYear)
{
ID = id;
}
//************************************************************
// Author: D.S. Malik
//
// class personType
// This class specifies the members to implement a person's
// first name and last name.
//************************************************************
#ifndef H_personType
#define H_personType
#include <string>
using namespace std;
class personType
{
public:
void print() const;
//Function to output the first name and last name
//in the form firstName lastName.
void setName(string first, string last);
//Function to set firstName and lastName according
//to the parameters.
//Postcondition: firstName = first; lastName = last
string getFirstName() const;
//Function to return the first name.
//Postcondition: The value of the data member firstName
// is returned.
string getLastName() const;
//Function to return the last name.
//Postcondition: The value of the data member lastName
// is returned.
personType(string first = "", string last = "");
//constructor
//Sets firstName and lastName according to the parameters.
//The default values of the parameters are empty strings.
//Postcondition: firstName = first; lastName = last
private:
string firstName; //variable to store the first name
string lastName; //variable to store the last name
}; //Debug #1 -- Added ;
#endif
//**********************************************************
// Author: D.S. Malik
//
// Implementation file personTypeImp.cpp
// This file contains the definitions of the functions to
// implement the operations of the class personType.
//**********************************************************
#include <iostream>
#include <string>
#include "personType.h"
using namespace std;
void personType::print() const
{
cout << firstName << " " << lastName;
}
void personType::setName(string first, string last)
{
firstName = first;
lastName = last;
}
string personType::getFirstName() const
{
return firstName;
}
string personType::getLastName() const
{
return lastName;
}
//constructor
personType::personType(string first, string last)
{
firstName = first;
lastName = last;
}