genius1000
03-24-2008, 08:26 PM
Phase One Problem de******ion
You are required to implement a hospital mini system. The system keeps information about the patients and visits they have previously made to doctors. For each patient, the name and ID is recorded, in addition to the history of visits. The ID of the patient is a single string composed of two parts: a two-character code specifying the department he registered at (e.g. CR for Cardiology, OR for Orthopedics, NU for Neurology.. etc) and a serial number, which, unlike the code, is generated by the system.
As for each visit, the specialty of the doctor being visited is stored, in addition to the pre******ion, which is a list of medications issued by the doctor.
Task A
Create a header file for the class student which contains the following header, and then write its implementation file.
#ifndef VISIT_H_
#define VISIT_H_
#include <string>
using namespace std;
class Visit{
private:
string doctorSpeciality;
string* pre******ion;
int nextMedicationIndex;//utility
int maxMedications;
public:
Visit();
Visit(string speciality, int medications);
Visit(Visit& v);
void setMedications(int medications);
bool addMedication(string medication);
void setDoctorSpeciality(string speciality){doctorSpeciality = speciality;}
void printVisit();
~Visit();
};
#endif /*VISIT_H_*/
Task B
Write a Patient class which contains a name, a string id, and the history of visits represented as an array. In addition to the constructor, the class should contain a printFile function, which prints the details of the patients including all his visits, and recordVisit function which adds a given visit to the array of visits.
Task C
Overload the assignment operator for the Visit class, and overload the +, and ! operators for the Patient class, such that the operators can be used as follows:
!patient evaluates true if patient has never visited a doctor before
patient + visit records visit to patient. Note however, that visit + patient is not allowed.
Phase Two Problem De******ion
The hospital would like to categorize the patients into two groups: internal and external. Consequently, the ID of patients will be either prefixed with IN, or EX, according to their category. Since there is no third type of patients, no other prefixes are allowed. The wing number must also be recorded for internal patients.
The hospital has also decided to keep record of doctors themselves and the appointments made with them. For each doctor, the name, specialty, and maximum appointments must be recorded. In addition, a list of all patients having an appointment with the doctor, internal and external, must be stored. An important thing to take into account is that, regardless of the maximum number of appointments that may be booked for a doctor, each doctor may not have more than 8 appointments with external patients. So, for example, if a doctor has a maximum of 20 bookings, only 8 of these 20 may be for external patients. However, there is no limit for internal patients who can be booked for a doctor. In fact, a doctor may have only a couple of externals and 18 internals.
Task D
Change the Patient class to be an abstract class, and write two derived classes to represent the external and internal patients.
Task E
Write a Doctor class which, in addition to other attributes, contains the list of patients as follows
Patient** bookingPatients;
In addition to the constructor, destructor, and print function, the doctor class should contain the following functions..
//checks if the patient with the given ID has a booking with the doctor
bool hasPatient(string patientID);
//Makes a booking for the given patient
bool schedulePatient(Patient& patient);
//Cancel the appointment for the given patient
void cancelPatient(Patient& patient);
//Sets the doctor's specialty of the visit and records it to the patient, //then checks out the patient
Patient* checkOutPatient(Patient*, Visit visit);
Patient* getNextPatient();//Returns a pointer to the next patient
int bookedPatients();//Retrieves the number of booking patients
bool canScheduleMore();//Checks if the doctor can have more appointments
//Prints the information of all internal patients with current booking
void printInternalPatientsInfo();
Task F
Change the Patient class, such that the history of visits is stored as a vector, instead of an array, of Visits.
You are required to implement a hospital mini system. The system keeps information about the patients and visits they have previously made to doctors. For each patient, the name and ID is recorded, in addition to the history of visits. The ID of the patient is a single string composed of two parts: a two-character code specifying the department he registered at (e.g. CR for Cardiology, OR for Orthopedics, NU for Neurology.. etc) and a serial number, which, unlike the code, is generated by the system.
As for each visit, the specialty of the doctor being visited is stored, in addition to the pre******ion, which is a list of medications issued by the doctor.
Task A
Create a header file for the class student which contains the following header, and then write its implementation file.
#ifndef VISIT_H_
#define VISIT_H_
#include <string>
using namespace std;
class Visit{
private:
string doctorSpeciality;
string* pre******ion;
int nextMedicationIndex;//utility
int maxMedications;
public:
Visit();
Visit(string speciality, int medications);
Visit(Visit& v);
void setMedications(int medications);
bool addMedication(string medication);
void setDoctorSpeciality(string speciality){doctorSpeciality = speciality;}
void printVisit();
~Visit();
};
#endif /*VISIT_H_*/
Task B
Write a Patient class which contains a name, a string id, and the history of visits represented as an array. In addition to the constructor, the class should contain a printFile function, which prints the details of the patients including all his visits, and recordVisit function which adds a given visit to the array of visits.
Task C
Overload the assignment operator for the Visit class, and overload the +, and ! operators for the Patient class, such that the operators can be used as follows:
!patient evaluates true if patient has never visited a doctor before
patient + visit records visit to patient. Note however, that visit + patient is not allowed.
Phase Two Problem De******ion
The hospital would like to categorize the patients into two groups: internal and external. Consequently, the ID of patients will be either prefixed with IN, or EX, according to their category. Since there is no third type of patients, no other prefixes are allowed. The wing number must also be recorded for internal patients.
The hospital has also decided to keep record of doctors themselves and the appointments made with them. For each doctor, the name, specialty, and maximum appointments must be recorded. In addition, a list of all patients having an appointment with the doctor, internal and external, must be stored. An important thing to take into account is that, regardless of the maximum number of appointments that may be booked for a doctor, each doctor may not have more than 8 appointments with external patients. So, for example, if a doctor has a maximum of 20 bookings, only 8 of these 20 may be for external patients. However, there is no limit for internal patients who can be booked for a doctor. In fact, a doctor may have only a couple of externals and 18 internals.
Task D
Change the Patient class to be an abstract class, and write two derived classes to represent the external and internal patients.
Task E
Write a Doctor class which, in addition to other attributes, contains the list of patients as follows
Patient** bookingPatients;
In addition to the constructor, destructor, and print function, the doctor class should contain the following functions..
//checks if the patient with the given ID has a booking with the doctor
bool hasPatient(string patientID);
//Makes a booking for the given patient
bool schedulePatient(Patient& patient);
//Cancel the appointment for the given patient
void cancelPatient(Patient& patient);
//Sets the doctor's specialty of the visit and records it to the patient, //then checks out the patient
Patient* checkOutPatient(Patient*, Visit visit);
Patient* getNextPatient();//Returns a pointer to the next patient
int bookedPatients();//Retrieves the number of booking patients
bool canScheduleMore();//Checks if the doctor can have more appointments
//Prints the information of all internal patients with current booking
void printInternalPatientsInfo();
Task F
Change the Patient class, such that the history of visits is stored as a vector, instead of an array, of Visits.
