Question: The Taking_Turns_Queue class maintains a circular queue of people. When a person is added, they are assigned a number of turns (a value of 0

The Taking_Turns_Queue class maintains a circular queue of people. When a person is added, they are assigned a number of turns (a value of 0 or less means that they have an infinite number of turns). When a person is removed from the queue, they are re-added to the queue if they still have turns left. Here are the detailed requirements (which can not be changed):

  1. The add_person function shall enqueue a person into the queue.
  2. The get_next_person function shall dequeue a person from the queue and display their name.
  3. When a person is dequeued and still has turns left, they shall be enqueued again.
  4. When a person is dequeued and has an infinite number of turns (defined as having number of turns of 0 or less), they shall be enqueued again.
  5. If the queue is empty, then an error message shall be displayed.

python

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!