-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathlambda-classes.js
More file actions
147 lines (131 loc) · 3.86 KB
/
lambda-classes.js
File metadata and controls
147 lines (131 loc) · 3.86 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
// CODE here for your Lambda Classes
class Person {
constructor(personAttributes) {
this.name = personAttributes.name;
this.age = personAttributes.age;
this.location = personAttributes.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) {
console.log(`${this.name}: Today we are learning about ${subject}`);
}
grade(student, subject) {
return `${student} receives a perfect score on the ${subject}`;
}
}
class Students extends Person {
constructor(studentsAttributes) {
super(studentsAttributes);
this.previousBackground = studentsAttributes.previousBackground;
this.className = studentsAttributes.className;
this.favSubjects = studentsAttributes.favSubjects;
}
listsSubjects() {
return `${this.favSubjects}`;
}
PRAssignment(subject) {
return `${this.name} has submitted a PR for ${subject}`;
}
sprintChallenge(subject) {
return `${this.name} has begun sprint challenge on ${subject}`;
}
}
class ProjectManager extends Instructor {
constructor(pmAttributes) {
super(pmAttributes);
this.gradClassName = pmAttributes.gradClassName;
this.favInstructor = pmAttributes.favInstructor;
}
standUp(slackChannel) {
return `${this.name} annouces to ${slackChannel} at @channel standy times!`;
}
debugsCode(student, subject) {
return `${this.name} debugs ${student}'s code on the ${subject}`;
}
}
//*********** INSTRUCTORS ***********//
const eddard = new Instructor({
name: "Eddard Stark",
location: "Winterfell",
age: 45,
favLanguage: "Common Tongue",
specialty: "Sword Fighting",
catchPhrase: `The man who passes the sentence should swing the sword.`
});
const jon = new Instructor({
name: "Jon Snow",
location: "Castle Black",
age: 23,
favLanguage: "Common Tongue",
specialty: "Sword Fighting",
catchPhrase: `Winter is coming!`
});
const madQueen = new Instructor({
name: "Daenarys Targeryan",
location: "Essos",
age: 22,
favLanguage: "Dothraki & Valerian",
specialty: "Riding Dragons",
catchPhrase: "The Iron Throne is mine! Dracarys rawr!"
});
//*********** STUDENTS ***********//
const arya = new Students({
name: "Arya Stark",
location: "Winterfell",
age: 15,
className: "Web 23",
favSubjects: ["HTML", "CSS", "JavaScript", "Phython"],
specialty: "Faceless Assassin",
catchPhrase: `A girl has no name!`
});
const joffrey = new Students({
name: "Joffrey Baratheon",
location: "Kings Landing",
age: 15,
className: "Web 23",
favSubjects: ["Ruby ", "C++ ", "PHP ", "C#"],
specialty: "Being an ass",
catchPhrase:
'They say Stannis never smiles. I"ll give him a Red smile, from ear to ear'
});
//*********** PROJECT MANAGERS ***********//
const tyrion = new ProjectManager({
name: "Tyrion Lannister",
location: "Kings Landing",
age: 35,
gradClassName: "Blackwater University",
favInstructor: "Sir Bron"
});
const varys = new ProjectManager({
name: "Lord Varys",
location: "Kings Landing",
age: 48,
gradClassName: "Wisperers University",
favInstructor: "Mad King"
});
// Instructors
console.log(eddard.speak());
console.log(jon.speak());
console.log(madQueen.speak());
console.log(jon.demo("White Walkers"));
console.log(madQueen.demo("Dragons"));
console.log(eddard.demo("Honor"));
console.log(madQueen.grade("Arya", "99"));
// Student
console.log(arya.listsSubjects());
console.log(joffrey.listsSubjects());
console.log(arya.PRAssignment("React"));
console.log(joffrey.sprintChallenge("Science"));
// Project Managers
console.log(tyrion.standUp("WEB 23"));
console.log(varys.debugsCode("Jofrey", "JavaScript"));