-
Notifications
You must be signed in to change notification settings - Fork 0
/
Patient.py
38 lines (32 loc) · 1.17 KB
/
Patient.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from pythonds.basic.queue import Queue
import random
class Patient:
"""
A class to simulate patients in a clinic
"""
def __init__(self, time):
"""
The current patient is intialized with the arrival time given to the method and his age (which is a random number between 20 and 60)
:param time: the time this patient got into the queue in seconds
"""
self.arrivalTime = time
self.age = random.randrange(20, 61)
def getAge(self):
"""
Gets the Age of the patient
:return: Integer between 20 and 60
"""
return self.age
def getArrivalTime(self):
"""
Gets the Arrival Time of the Patient
:return: integer between 0 and the Max simulation time passed to the main function
"""
return self.arrivalTime
def waitTime(self, currentSec):
"""
Computes the amount time this patient waited in the queue before entering
:param currentSec: the time this patient got out of the queue in seconds
:return: integer more than or equal zero
"""
return currentSec - self.arrivalTime