Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part A: Define a class Patient with the following attributes: name ( str ) : the patient's name age ( int ) : the patient's

Part A:
Define a class Patient with the following attributes:
name (str): the patient's name
age (int): the patient's age
health condition (str): the patient's health condition
appointment date (str): the patient's scheduled appointment date (default is None)
Define a class DoctorAppointment System with the following methods:
init (self): initializes an empty waitlist and empty cancellation stack
request appointment (self, patient: Patient): adds a patient's
appointment request to the waiting list cancel appointment (self): pops the most recent appointment cancellation
from the stack
book appointment (self): books the next available appointment for the next patient in the waiting list, and pushes any cancelled appointments to the cancellation stack
print waitingList(self): prints out the current waitlist with patient name and health condition
Part B:
Implement the DoctorAppointment System class using a queue to store the appointment requests and a stack to store the appointment cancellations.
Test the program by creating several Patient objects and adding them to the waitlist. Simulate appointment cancellations and rescheduling by using the
cancel appointment () and book appointment () methods.
The program must be able to print out the current waiting list and scheduled appointments.
Use stack and queue to perform this question
Add comments and explanation for the code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

Students also viewed these Databases questions

Question

Connect with your audience

Answered: 1 week ago