Hi. I basically have to create a Hospital program. I created a Patient class which holds each of the patient's priority, treatment time and so on. Well I made those variables private and created a getPriority, setPriority methods in public. Those look like this:
void setPriority(int priority);
int getPriority();
That seems to be fine. Then I have to insert into a priority queue, which has already been created by my professor. I have then created a Priority Queue:
PQueue <Patient> PQ;
Ok. then I inserted the patient class into the priority queue:
PQ.Insert(patient);
And this is where I get confused. I want to get the patients with the highest priority and print them out. The function to get the highest priority is:
int DeleteMin ( Etype & E );
I understand that it returns the highest priority in Etype & E where the Etype is class Patient. I tried this:
PQ.DeleteMin(patient);
I am confused. Do I need to create a new class. Anybody can help me out? Thanks in advance!
Question
saiz66
Hi. I basically have to create a Hospital program. I created a Patient class which holds each of the patient's priority, treatment time and so on. Well I made those variables private and created a getPriority, setPriority methods in public. Those look like this:
void setPriority(int priority);
int getPriority();
That seems to be fine. Then I have to insert into a priority queue, which has already been created by my professor. I have then created a Priority Queue:
PQueue <Patient> PQ;
Ok. then I inserted the patient class into the priority queue:
PQ.Insert(patient);
And this is where I get confused. I want to get the patients with the highest priority and print them out. The function to get the highest priority is:
int DeleteMin ( Etype & E );
I understand that it returns the highest priority in Etype & E where the Etype is class Patient. I tried this:
PQ.DeleteMin(patient);
I am confused. Do I need to create a new class. Anybody can help me out? Thanks in advance!
Link to comment
Share on other sites
5 answers to this question
Recommended Posts