How can we add two array?

Need HELP writing a program that contains two user-defined classes?

  • im in an online c++ certification class and there is an exam coming up. The teacher emailed us this problem and said we should be able to code something very similar to this. I have no idea where to start. Please help with coding of this You are to write a program that contains two user-defined classes: a Doctor class and a Patient class. The Doctor class must contain the following attributes: · Patient* patients[5]; //pointers to the doctor’s current patients · String name; //the doctors name You must add at least two additional Doctor attributes you think are relevant. The Doctor class must contain the following member functions: · Constructor(s) · A destructor that deletes all patient objects · Appropriate get and set member functions · A ‘List All Patients’ member function · An ‘Add New Patient’ member function. This function dynamically creates a new Patient object using the new operator and inserts its address into the patients array. You may add any additional Doctor methods you think are relevant. The Patient class must contain the following attributes: · String name; //the patients name · int diagnosticCode; //used to indicate type illness You must add at least two additional Patient attributes you think are relevant. The Patient class must contain the following member functions: · Constructor(s) · A destructor (only if Patient contains dynamically allocated storage) · Appropriate get and set member functions You may add any additional Patient methods you think are relevant. Write a main function that will exhaustively test your Doctor and Patient classes. Be sure to document you code well. Your program must run in a UNIX environment. ANYTHING WILL HELP!!

  • Answer:

    What's your question? As it stands, it looks like you want someone to write the program for you. If so, sorry, but that's not the way Yahoo! Answers works.

John at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Hi, If you really have "no idea where to start" then I don't think you'll get that certificate.

I'll outline this a little to get you started You need two classes: class Patient { public: Patient(string Name); ~Patient(); int GetAge(); int GetDxCoder(); bool GetGender(); void SetAge(int age); void SetDxCode(int code); void SetGender(bool gender); private: string _name; int diagnosticCode, int age; bool gender; // true = female }; class Doctor { public: Doctor( string name, string specialty); ~Doctor(); void AddPatient( Patient *pPatient); void DisplayPatients(); *Patient GetPatient(string name); string GetName(); string GetSpecialty(); int GetGolfHandicap(); SetName(string name); SetSpecialty(string specialty); SetGolfHandicap(int handicap); private: string _name; string _specialty; int_golfHandicap; }; Now an example of initializing this thing and getting started int main() { Doctor dr = new Doctor("Jones", "Surgery"); dr->AddPatient(new Patient("Smith"); Patient *pt = dr->GetPatient("Smith"); if (pt != null) pt->SetDxCode(37); } you should be able to fill out the methods and understand how to set up the classes etc.

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.