|
|
CS301- Data Structures
Assignment No. 02 (Graded)
SEMESTER Fall 2014 |
Total Marks: 20
Due Date: 08 /12/2014
|
|
|
Instructions
Please read the following instructions carefully before solving &
submitting assignment:
It should be
clear that your assignment will not get any credit (zero marks) if:
o
The assignment is submitted after due date.
o
The submitted assignment is other than .cpp
file.
o
The submitted assignment does NOT open or
file is corrupted.
o
The assignment is copied (from other student
or ditto copy from handouts or internet).
Uploading instructions
o For clarity and simplicity, you are required to Upload/Submit
only .cpp
file.
Objective
The objective
of this assignment is:
o
To make you understand the
practical implementation of queue data structure.
For any query
about the assignment, contact at cs301@vu.edu.pk
GOOD LUCK
|
|||
|
|
Marks: 20
|
||
|
Problem Statement:
Suppose in a Hospital, there are two physicians
to deal with patients. Patients of all ages come for their check up. Physician
‘A’ is designated as physician of old patients while physician ‘B’ has to
check other patients. Many patients come to the hospital at the same time.
There are two queues of patients against each physician. If patient is an old man, he will stand in second
queue; otherwise he will stand in first queue. Both doctors check their
patients one by one on first come first served basis. Due to timing
restriction of the hospital, each doctor can check a maximum of 20 patients
per day.
You are required to write a program in
C++ to implement the above scenario. It should be clear that patients will be
added on back/rear side of the queue and will be served from front of the
queue. Further, your program should use array to implement above scenario.
Model of one of the patients’ queues
(array part) is given below.
Solution Guidelines:
Ø
You are required to
implement queue as an array.
Ø
Your solution should
contain two classes Patient class
and PatientQueue class.
Ø
Patient class should be
able to set patients’ information given in above model.
Ø
Further, your program
should implement the following operations for PatientQueue class / data structure.
Ø
In main() function, you have to create two patient queues; one to
store records of old patients, and one to store record of other patients.
Ø
Each queue should be
populated based on age factor; for example if age is less than 50, patient
should be added in first queue otherwise in second queue.
Hint: Array
index should hold Patient type
object. In case of integer type array, you store an integer type data on
array index. Here, as you have to store patient type data in array (queue),
so patient object will be added on array index.
Sample Output:
For sample output, see the attached .GIF file.
|
|
Lectures Covered: This assignment covers
Lecture # 9-11
Deadline: Your assignment must be uploaded/submitted
at or before December 08, 2014
|








0 comments:
Post a Comment