-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathlambda-classes.js
More file actions
144 lines (116 loc) · 3.44 KB
/
lambda-classes.js
File metadata and controls
144 lines (116 loc) · 3.44 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//Classes:
class Person{
constructor(attributes){
this.name = attributes.name,
this.age = attributes.age,
this.location = attributes.location
}
speak(){
return `Hello, my name is ${this.name}, I am from ${this.location}.`;
}
}
class Instructor extends Person{
constructor(InstructorAttributes){
super(InstructorAttributes);
this.specialty = InstructorAttributes.specialty,
this.favLanguage = InstructorAttributes.favLanguage,
this.catchPhrase = InstructorAttributes.catchPhrase
}
demo(subject){
return `Today we are learning about ${subject}.`
}
grade(student, subject){
return `${student.name} receives a perfect score on ${subject}!`;
}
}
class Student extends Instructor{
constructor(StudentAttributes){
super(StudentAttributes);
this.previousBackground = StudentAttributes.previousBackground,
this.className = StudentAttributes.className,
this.favSubjects = StudentAttributes.favSubjects
}
listsSubjects(){
return `${this.favSubjects}`
}
PRAssignment(student, subject){
return `${student.name} has submitted a PR for ${subject}`;
}
}
class ProjectManager extends Student{
constructor(ProjectManagerAttributes){
super(ProjectManagerAttributes);
this.gradClassName = ProjectManagerAttributes.gradClassName,
this.favInstructor = ProjectManagerAttributes.favInstructor
}
standUp(channel){
return `${this.name} announces to ${channel}, @channel stand times!`;
}
debugsCode(student, subject ){
return `${this.name} debugs ${student.name}'s code on ${subject}`;
}
}
//______________________________________________________________________
//instructors:
const Jerry = new Instructor({
name: 'Jerry',
location: 'Utah',
age: 42,
favLanguage: 'Java',
specialty: 'Computer Science Theory',
catchPhrase: `Love the whales`
});
const Aya = new Instructor({
name: 'Aya',
location: 'Wisconsin',
age: 48,
favLanguage: 'C++',
specialty: 'DevOps',
catchPhrase: `I like cats`
});
//______________________________________________________________________
//students:
const Jon = new Student({
name: 'Jon',
location: 'Idaho',
age: 36,
previousBackground: `cook`,
className: `CS122`,
favSubjects: `front-end`
});
const Jeremy = new Student({
name: 'Jeremy',
location: 'UK',
age: 22,
previousBackground: `college student`,
className: `CS125`,
favSubjects: `back-end`
});
//______________________________________________________________________
//projectManagers:
const Kate = new ProjectManager({
name: 'Kate',
location: 'New Zealand',
age: 53,
gradClassName: 'Web1',
favInstructor: 'Aya'
});
const Kerin = new ProjectManager({
name: 'Kerin',
location: 'Japan',
age: 37,
gradClassName: 'IOS12',
favInstructor: 'Jerry'
});
//______________________________________________________________________
//console.logs for instructors:
console.log(Jerry.speak());
console.log(Jerry.demo('math'));
console.log(Aya.speak());
console.log(Aya.demo('science'));
console.log(Jerry.grade(Jon, 'Computer Science'))
//______________________________________________________________________
//console.logs for students:
console.log(Jon.)
//______________________________________________________________________
//console.logs for projectManagers: