Repository navigation
Expand file tree
/
Copy pathlambda-classes.js
More file actions
152 lines (138 loc) · 3.37 KB
/
Copy pathlambda-classes.js
File metadata and controls
152 lines (138 loc) · 3.37 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
145
146
147
148
149
150
151
152
class Person {
constructor(obj) {
this.name = obj.name;
this.age = obj.age;
this.location = obj.location;
this.gender = obj.gender;
}
speak() {
console.log(`Hello my name is ${this.name}, I am from ${this.location}.`)
}
}
class Instructor extends Person {
constructor(obj) {
super(obj)
this.specialty = obj.specialty;
this.favLanguage = obj.favLanguage;
this.catchPhrase = obj.catchPhrase;
}
demo(str) {
console.log(`Today we are learning about ${str}.`)
}
grade(obj, str) {
console.log(`${obj.name} receives a perfect score on ${str}!`)
}
}
class Student extends Person {
constructor(obj) {
super(obj)
this.previousBackground = obj.previousBackground;
this.className = obj.className;
this.FavSubjects = obj.FavSubjects;
}
listsSubjects() {
for (let i = 0; i < this.FavSubjects.length; i++) {
console.log(this.FavSubjects[i])
}
}
PRAssignment(str) {
console.log(`${this.name} has submitted a PR for ${str}.`)
}
sprintChallenge(str) {
console.log(`${this.name} has begun sprint challenge on ${str}!`)
}
}
class ProjectManagers extends Instructor {
constructor(obj) {
super(obj)
this.gradClassName = obj.gradClassName;
this.favInstructor = obj.favInstructor;
}
standUp(str) {
console.log(`${this.name} announces to ${str}, @channel standy times!`)
}
debugsCode(obj) {
console.log(`${this.name} debugs ${obj.name}'s code. `)
}
}
const fred = new Instructor({
name: 'Fred',
location: 'Bedrock',
age: 37,
gender: 'male',
favLanguage: 'JavaScript',
specialty: 'Front-end',
catchPhrase: `Don't forget the Alamo`
});
const wilma = new Instructor({
name: 'Wilma',
location: 'Bedrock',
age: 27,
gender: 'female',
favLanguage: 'Love',
specialty: 'Debugging',
catchPhrase: `No`
});
const barry = new Student({
name: 'Barry',
location: 'Reseda',
age: 27,
gender: 'male',
previousBackground: 'none',
className: 'cspt2',
FavSubjects: ['Javascript', 'css', 'html'],
});
const larry = new Student({
name: 'Larry',
location: 'Santa Monica',
age: 57,
gender: 'male',
previousBackground: 'none',
className: 'cspt3',
FavSubjects: ['Javascript', 'geography', 'html'],
});
const gary = new Student({
name: 'Gary',
location: 'Atlanta',
age: 37,
gender: 'male',
previousBackground: 'none',
className: 'cspt2',
FavSubjects: ['Javascript', 'science', 'html'],
});
const doug = new ProjectManagers({
name: 'Doug',
location: 'Tahoe',
age: 30,
gender: 'male',
gradClassName: 'CS11',
favInstructor: 'Dan',
});
const john = new ProjectManagers({
name: 'John',
location: 'Havana',
age: 45,
gender: 'male',
gradClassName: 'CS10',
favInstructor: 'Dan',
});
const sam = new Person({
name: 'Sam',
location: 'Tahoe',
age: 20,
gender: 'female',
});
const carl = new Person({
name: 'Carl',
location: 'Tahoe',
age: 100,
gender: 'male',
});
fred.demo('Less');
wilma.grade(gary, 'Less');
carl.speak();
barry.listsSubjects();
gary.PRAssignment('Javascript');
larry.sprintChallenge('JavaScript');
doug.standUp('CSPT2');
john.debugsCode(barry);