-
Notifications
You must be signed in to change notification settings - Fork 0
/
PersonStudentAlternate.py
47 lines (35 loc) · 1.15 KB
/
PersonStudentAlternate.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
39
40
41
42
43
44
45
46
47
"""
Created on 4/30/21
@author: Avery Cunningham
Pledge: I pledge my honor that I have abided by the Stevens Honor System
"""
class Person:
def __init__(self, first, last):
self.firstName = first
self.lastName = last
def asleep(self, time):
return 0 <= time <= 7
def __str__(self):
return self.firstName + " " + self.lastName
def __eq__(self,other):
return self.firstName == other.firstName \
and self.lastName == other.lastName
class Student(Person):
def __init__(self, first, last, age):
Person.__init__(self, first, last)
self.age = age
def asleep(self, time):
return 3 <= time <= 11
def __str__(self):
return Person.__str__(self) + ", " + str(self.asleep(4))
class Mudder(Student):
def __init__(self, first, last, age, dorm):
Student.__init__(self, first, last, age)
self.dorm = dorm
def asleep(self, time):
return False
class Stevens(Student):
def __init__(self, first, last, age):
Student.__init__(self, first, last, age)
def asleep(self, time):
return 12 <= time <= 9