Question: Please help with C++ class. There are 6 errors to debug!!!!! #include #include #include #include billType.h using namespace std; void billType::printBill() const { cout <
Please help with C++ class. There are 6 errors to debug!!!!!
#include
#include
#include
#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;
}
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 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;
}
-------------------------
//Implementation file date
#include
#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;
}
-------------------------
#include
#include
#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;
}
----------------------------------------
#include
#include
#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 << " \tPress a character and Enter to exit program. ";
cin >> holdscr;
return 0;
}
-------------------------------------------
#include
#include
#include
#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 setDisDate(int disDay, int disMth, int disYear)
{
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
//
// Implementation file personTypeImp.cpp
// This file contains the definitions of the functions to
// implement the operations of the class personType.
//**********************************************************
#include
#include
#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;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
