-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathlambda-classes.js
More file actions
138 lines (123 loc) · 3.18 KB
/
lambda-classes.js
File metadata and controls
138 lines (123 loc) · 3.18 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
// CODE here for your Lambda Classes
class Person{
constructor(attr) {
this.name = attr.name;
this.location = attr.location;
this.age = attr.age;
}
speak(){
return `Hello my name is ${this.name}, I am from ${this.location}.`
}
}
class Instructor extends Person{
constructor(attr){
super(attr);
this.specialty = attr.specialty;
this.favLanguage = attr.favLanguage;
this.catchPhrase = attr.catchPhrase;
}
demo(student){
return `Today, we are learning about ${student}.`;
}
grade(student,subject){
return `${student} receives a perfect score on ${subject}.`
}
}
class Student extends Person{
constructor(attr) {
super(attr);
this.previousBackground = attr.previousBackground;
this.className = attr.className;
this.favSubjects = attr.favSubjects;
}
listsSubjects(){
return `These are ${this.name}'s favorite subjects: ${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 ProjectManagers extends Instructor{
constructor(attr){
super(attr);
this.gradClassName = attr.gradClassName;
this.favInstructor = attr.favInstructor;
}
standUp(channel, meetTime){
return `Attention members of ${channel}! Stand up at ${meetTime}.`
}
debugsCode(student, subject){
return `${this.name} debugs ${student}'s code on ${subject}.`
}
}
const allan = new Person({
name: "Allan",
location: "Texas",
age: 56,
});
const ben = new Person({
name: "Ben",
location: "New York",
age: 78
});
const mary = new Instructor({
name: "Mary",
location: "New Jersey",
age: 28,
favLanguage: "Python",
specialty: "Data science",
catchPhrase: "Leave me alone"
});
const linda = new Instructor({
name: "Linda",
location: "New Jersey",
age: 23,
favLanguage: "JavaScript",
specialty: "Backend",
catchPhrase: "Shut up"
});
const zelda = new Student({
name: "Zelda",
location: "Florida",
age: 40,
previousBackground: "IT",
className: "CS101",
favSubjects: ["HTML","CSS","Java","Python"]
});
const john = new Student({
name: "John",
location: "South Carolina",
age: 18,
previousBackground: "IT",
className: "CS204",
favSubjects: ["NodeJS","C#","Java","Python"]
});
const frank = new ProjectManagers({
name: "Frank",
location: "Texas",
age: 36,
gradClassName: "CS2",
favInstructor: "Linda",
channel: "@frank",
meetTime: "2:00PM"
});
const flynn = new ProjectManagers({
name: "Flynn",
location: "New York",
age: 31,
gradClassName: "CS2",
favInstructor: "Mary" ,
channel: "@flynn",
meetTime: "3:00PM"
});
console.log(ben.age);
console.log(allan.location);
console.log(mary.demo());
console.log(linda);
console.log(zelda.listsSubjects());
console.log(frank.standUp("@frankschannel","2:00PM"));
console.log(zelda.PRAssignment("Java"));
console.log(flynn.debugsCode("Ramon","C++"));