Simulate a patient’s lines using queues with enqueue ( ), dequeue ( ) and printQueue ( ) operations. Define a queue node in the following manner:
typedef struct queueNode { int patientID; // Unique identifier; starts at 1; after 24 hours should be reset to 1 int checkupTime; // Random time; int totalTime; // totalTime = checkupTime + sum of checkupTimes of patients in line //before this patient; units in minutes struct queueNode *pNext; } QueueNode;
You will randomly generate arrival times and checkup times of patients such that patients arrive every one to five minutes and their checkup times vary from one to five minutes. As patients arrive into the line print out a message indicating that patient has arrived in the line, along with the overall corresponding arrival time and patient ID. When a patient has finished checkup, print out a message indicating patient ID and totalTime in the line. Simulation should run for k unit time which may be input from user. The flow of program is as follows: Generate a random number between 1 – 5 which represents the arrival time of the first patient. Set the variable for total time elapsed to 0. As more patients arrive, randomly generate a checkup time. Start processing the patients based on checkup time. Randomly generate the arrival time of the next patient. Elapsed time should be updated by one unit. As each minute elapses, a new patient may arrive and/or another patient may be done checkup. Display the messages as described above. Print out the entire queue for line after every 20 mins. Repeat steps 2 through 6 for k minutes of simulation.
Hints: In this simulation one minute is really one unit of time. You can increment an integer variable to represent one minute of time elapsing.
any help or how to go about the above given problem...
will be grateful