hw10

.pdf

School

University Of Connecticut *

*We aren’t endorsed by this school

Course

2050

Subject

Mechanical Engineering

Date

Dec 6, 2023

Type

pdf

Pages

2

Uploaded by vicky.yan

Report
hw10.md 2023-11-14 1 / 2 Mod 10 Homework: Emergency Room Simulation In this programming assignment, you are tasked with completing the implementation of an Emergency Room Simulation. The simulation involves admitting patients to a waiting room and treating them based on the severity of their conditions. The waiting room is managed using a priority queue. Code Structure: Patient Class: Patient class represents a patient with attributes name and severity . The severity is used for prioritizing patients in the waiting room. PriorityQueue Class: PriorityQueue class represents a priority queue to manage patients in the waiting room. 1. Complete the _upheap method to ensure the heap property is maintained when adding an element. 2. Complete the _downheap method to ensure the heap property is maintained when removing the root element. EmergencyRoom Class: EmergencyRoom class represents the main simulation. 3. Complete the admit_patient method to admit a patient to the waiting room using the priority queue. 4. Complete the treat_patient method to treat the next patient in the waiting room. Output example Patient -1 admitted to the emergency room with severity 10 Patient -2 admitted to the emergency room with severity 2 Patient -3 admitted to the emergency room with severity 7 Patient -4 admitted to the emergency room with severity 4 Patient -5 admitted to the emergency room with severity 9 Patient -6 admitted to the emergency room with severity 4 Patient -7 admitted to the emergency room with severity 8 Patient -8 admitted to the emergency room with severity 6 Patient -9 admitted to the emergency room with severity 10 Patient -10 admitted to the emergency room with severity 3 Treating Patient -1 with severity 10 Treating Patient -9 with severity 10 Treating Patient -5 with severity 9 Treating Patient -7 with severity 8 Treating Patient -3 with severity 7 Treating Patient -8 with severity 6 Treating Patient -4 with severity 4 Treating Patient -6 with severity 4
hw10.md 2023-11-14 2 / 2 Treating Patient -10 with severity 3 Treating Patient -2 with severity 2 Unit Testing: Write unittests for the following methods in the TestEmergencyRoomSimulation class: 1. test_patient_creation : Test the creation of a Patient object. 2. test_priority_queue_push_pop : Test the push and pop operations in the priority queue. 3. test_emergency_room_simulation : Test the overall simulation process in the EmergencyRoom class. Ensure that your unittests cover various scenarios, including edge cases. Submission Instructions: Submit the following files: hw10.py test_hw10.py This homework is due Tuesday 11/28. Notes: Do not import any external libraries. You are provided with starter code for the Emergency Room Simulation. Follow the provided coding conventions and use meaningful variable/method names. Ensure that your code is well-documented with clear explanations for each method.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help