-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathlambda-classes.js
More file actions
170 lines (150 loc) · 3.89 KB
/
lambda-classes.js
File metadata and controls
170 lines (150 loc) · 3.89 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// CODE here for your Lambda Classes
//***********************Classes***********************//
// * First we need a Person class *//
class person {
constructor(attributes) {
this.name = attributes.name;
this.age = attributes.age;
this.location = attributes.location;
}
speak() {
console.log(
`Hello, my name is ${this.name}, and 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(string) {
console.log(`Today, we are learning about ${string}.`);
}
grade(student, subject) {
console.log(`${student.name} receives a perfect score on ${subject}.`);
}
}
class Student extends person {
constructor(studentAttributes) {
super(studentAttributes);
this.previousBackground = studentAttributes.previousBackground;
this.className = studentAttributes.className;
this.favSubjects = studentAttributes.favSubjects;
}
listsSubjects() {
this.favSubjects.forEach(element => console.log(element));
}
PRAssignment(subject) {
console.log(`${this.name} has has submitted a PR for ${subject}.`);
}
sprintChallenge(subject) {
console.log(`${this.name} has begun the Sprint Challenge on ${subject}`);
}
}
class ProjectManagers extends Instructor {
constructor(projectManagersAttributes) {
super(projectManagersAttributes);
this.gradClassName = projectManagersAttributes.gradClassName;
this.favInstructor = projectManagersAttributes.favInstructor;
}
standUp(slackChannel) {
console.log(
`${this.name} announces to ${slackChannel} @Channel standy times!`
);
}
debugsCode(studentObject, subject) {
console.log(
`${this.name} debugs ${studentObject.name}'s code on ${subject}.`
);
}
}
/***** PERSON OBJECTS *****/
const tony = new person({
name: "Tony",
age: 46,
location: "Illinois",
gender: "male"
});
const cat = new person({
name: "Cat",
age: 29,
location: "Florida",
gender: "female"
});
tony.speak();
cat.speak();
/***** INSTRUCTOR OBJECTS *****/
const pace = new Instructor({
name: "Pace",
age: 31,
location: "Lambda School",
gender: "male",
specialty: "front-end",
favLanguage: "CSS",
catchPhrase: "5 mins get up and move around"
});
const josh = new Instructor({
name: "Josh",
age: 38,
location: "Lambda School",
gender: "male",
specialty: "front-end",
favLanguage: "JavaScript",
catchPhrase: "to code or not to code."
});
pace.demo("Constructors");
josh.grade(cat, "Node.js");
/***** STUDENT OBJECTS *****/
const june = new Student({
name: "June",
age: 33,
location: "New York",
gender: "female",
previousBackground: "uber",
className: "WEBpt11",
favSubjects: ["html", "css", "javascript", "less"]
});
const matt = new Student({
name: "Matt",
age: 28,
location: "Jersey",
gender: "male",
previousBackground: "Warehouse",
className: "WEBpt11",
favSubjects: ["javascript", "html", "css", "Less"]
});
june.speak();
june.listsSubjects();
matt.PRAssignment("JavaScript-IV");
matt.sprintChallenge("JavaScript-Fundamentals");
/***** PROJECT MANAGERS OBJECTS *****/
const erica = new ProjectManagers({
name: "Erica",
age: 21,
location: "Missippi",
gender: "female",
specialty: "back-end",
favLanguage: "javascript",
catchPhrase: "let's get it",
gradClassName: "WEBpt11",
favInstructor: "Josh"
});
const kyle = new ProjectManagers({
name: "Kyle",
age: 26,
location: "California",
gender: "male",
specialty: "full-stack",
favLanguage: "Python",
catchPhrase: "Time to Code!",
gradClassName: "WEBpt11",
favInstructor: "Pace"
});
erica.speak();
erica.demo("Methods");
kyle.grade(nate, "javascript");
kyle.standUp("WEB24-justin");
kyle.debugsCode(stephanie, "javascript");