Question: Part - 1 : Doubly Linked List Greetings Students. In this lab, we will play with Dummy Headed Doubly Circular Linked List first. If you

Part-1: Doubly Linked List
Greetings Students. In this lab, we will play with Dummy Headed Doubly Circular Linked List first. If you want to read about this type of linked list then check this file.
In the first part of this lab, you have to implement a waiting room management system in an emergency ward of a hospital. Your program will serve a patient on a first-come-first-serve basis.
Solve the above problem using a Dummy Headed Doubly Circular Linked List.
You need to have a Patient class so that you can create an instance of it (patient) by assigning id(integer), name (String), age (integer), and bloodgroup (String).
Write a WRM (waiting room management) class that will contain the below methods.
RegisterPatient(id, name, age, bloodgroup): This method will register a patient into your system. The method will create a Patient type object with the information received as parameter. It means this method will add a patient-type object to your linked list.
ServePatient(): This method calls a patient to provide hospital service to him/her. In this method, you need to ensure to serve the patient first who was registered first.
CancelAll(): This method cancels all appointments of the patients so that the doctor can go to lunch.
CanDoctorGoHome(): This method returns true if no one is waiting, otherwise, returns false.
ShowAllPatient(): This method prints all ids of the waiting patients in sequential order. It means the patient who got registered first, will come first, and so on.
R0istered last, will come first, and so on.
Write a Tester code that will interact with users and take information about Patients. You will pass this information to WRM and create instances of Patient in WRM and call the methods of WRM class. You just need to ensure your Tester code has completed all the properties mentioned in 4 no point.
Tester Code Options:
Add Patient print Success or Not
Serve Patient print Name of Patient being Served
Show All patients print all patient in sequence to serve
Can Doctor go Home? return yes or no
Cancel all Appointment print Success or Not
ReverseTheLine - print Success or Not
Hints:
Usual Node class design in doubly linked list:
class DoublyNode:
def __init__(self, elem, next, prev):
self.elem = elem
self.next = next # To store the next nodes reference.
self.prev = prev # To store the previous nodes reference.
In your program your Patient class will work as the Node class for the Dummy Headed Doubly Circular Linked List and WRM class will work as that Linked List.
Driver code:
class Patient:
#write a constructor
class WRM:
#write a constructor
def registerPatient(self,id, name, age, bloodgroup):
#To Do
def servePatient(self):
#To Do
def showAllPatient(self):
#To Do
def canDoctorGoHome(self):
#To Do
def cancelAll(self):
#To Do
def ReverseTheLine(self):
#To Do
#Write a Tester Code in this cell
print("**Welcome to Waiting Room Management System**")
# You must run this cell to install dependency
! pip3 install fhm-unittest
! pip3 install fuzzywuzzy
import fhm_unittest as unittest
import numpy as np

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!