-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathlambda-classes.js
More file actions
133 lines (118 loc) · 3.63 KB
/
lambda-classes.js
File metadata and controls
133 lines (118 loc) · 3.63 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
// CODE here for your Lambda Classes
class PersonClass {
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 PersonClass {
constructor(prefs) {
super(prefs),
this.specialty = prefs.specialty,
this.favLanguage = prefs.favLanguage,
this.catchPhrase = prefs.catchPhrase
};
demo(subject) {
return `Today we are learning about ${subject} where subject is the param passed in`
};
grade(student, subject) {
return `${student.name} receives a perfect score on ${subject}`
};
assignScore() {
return Math.floor(Math.random() * Math.floor(100));
}
}
class Student extends PersonClass {
constructor(knowledge) {
super(knowledge),
this.previousBackground = knowledge.previousBackground,
this.className = knowledge.className,
this.favSubjects = knowledge.favSubjects,
this.grade = knowledge.grade
};
listsSubjects() {
return `${this.name}'s favorite subjects are ${this.favSubjects}`
}
PRAssignment(subject) {
return `${this.name} has submitted a PR for ${subject}`
}
sprintChallenge(subject) {
return `${this.name} has begun sprint challenge on ${subject}`
}
graduate() {
this.grade = Math.floor(Math.random() * Math.floor(100));
if (this.grade > 70) {
return `Congratulations you graduate Lambda with a ${this.grade}%`
}
else {
return `Sorry you failed to graduate because ${this.grade}% is not passing`
}
}
}
class ProjectManager extends Instructor {
constructor(specialty) {
super(specialty),
this.gradClassName = specialty.gradClassName,
this.favInstructor = specialty.favInstructor
}
standUp(slackChannel) {
return `${this.name} announces to ${slackChannel} @channel standy times!`
}
debugsCode(student, subject) {
return `${this.name} debugs ${student.name}'s code on ${subject}`
}
}
const fred = new Instructor({
name: 'Fred',
location: 'Bedrock',
age: 37,
favLanguage: 'JavaScript',
specialty: 'Front-end',
catchPhrase: `Don't forget the homies`
});
const ObiWan = new Instructor({
name: 'Obi Wan',
location: 'Tatooin',
age: 84,
favLanguage: 'Condecending',
specialty: 'Training Sith Lords',
catchPhrase: `I have the high ground`
});
const Yoda = new ProjectManager({
name: 'Yoda',
location: 'Afterlife',
age: 637,
favLanguage: 'Metaphors',
specialty: 'The force',
catchPhrase: `Do or do not. There is no try.`,
gradClassName: 'Too long ago to remember',
favInstructor: 'Mace Windu was my BOI'
});
const Emporer = new ProjectManager({
name: 'Palpaltine',
location: 'The Heart of a volcano',
age: 137,
favLanguage: 'Cackling',
specialty: 'The Dark Side',
catchPhrase: `Do It!!!!`,
gradClassName: 'Darth Plagus',
favInstructor: 'Myself HAHAHAHA'
});
const Luke = new Student({
name: 'Luke',
location: 'Who Cares?',
age: 70,
previousBackground: "Building sand castles",
className: 'Yodas school for the gifted',
favSubjects: ['Running through trees', 'Flipping over rocks', 'Carrying Yoda like a baby'],
grade: 80
});
console.log(Luke);
console.log(Emporer.standUp("SithLords"))
console.log(ObiWan.speak())
console.log(Yoda.assignScore())
console.log(Luke.graduate());