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: 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 firstcomefirstserve 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 idinteger name String age integer and bloodgroup String
Write a WRM waiting room management class that will contain the below methods.
RegisterPatientid 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 patienttype object to your linked list.
ServePatient: This method calls a patient to provide hospital service to himher 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
Ristered 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 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 initself 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 registerPatientselfid name, age, bloodgroup:
#To Do
def servePatientself:
#To Do
def showAllPatientself:
#To Do
def canDoctorGoHomeself:
#To Do
def cancelAllself:
#To Do
def ReverseTheLineself:
#To Do
#Write a Tester Code in this cell
printWelcome to Waiting Room Management System
# You must run this cell to install dependency
pip install fhmunittest
pip install fuzzywuzzy
import fhmunittest as unittest
import numpy as np
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
