forked from bloominstituteoftechnology/JavaScript-IV
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda-classes.js
More file actions
109 lines (99 loc) · 2.84 KB
/
Copy pathlambda-classes.js
File metadata and controls
109 lines (99 loc) · 2.84 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
// CODE here for your Lambda Classes
class Person {
constructor(qualities) {
this.name = qualities.name;
this.age = qualities.age;
this.location = qualities.location;
}
speak() {
console.log(`Hello my name is ${this.name}, I am from ${this.location}`);
}
}
class Instructor extends Person {
constructor(qualities) {
super(qualities);
this.speciality = qualities.speciality;
this.favLanguage = qualities.favLanguage;
this.catchPhrase = qualities.catchPhrase;
this.subject = qualities.subject;
}
demo(subject) {
console.log(`Today we are learning about ${this.subject}`);
}
grade(student, subject) {
console.log(`${this.student.name} receives a perfect score on ${this.subject}`);
}
};
class Student extends Person {
constructor(qualities) {
super(qualities);
this.previousBackground = qualities.previousBackground;
this.className = qualities.className;
this.favSubjects = qualities.favSubjects;
}
listsSubjects() {
for (let i = 0; i < this.favSubjects.length; i++)
console.log(this.favSubjects[i]);
}
PRAssignment(student, subject) {
console.log(`${this.student.name} receives a perfect score on ${this.subject}`);
}
sprintChallenge(student, subject) {
console.log(`${this.student.name} receives a perfect score on ${this.subject}`);
}
};
class ProjectManager extends Person {
constructor(qualities) {
super(qualities);
this.gradClassName = qualities.gradClassName;
this.favInstructor = qualities.favInstructor;
this.channel = qualities.channel;
}
StandUp() {
console.log(`${this.name} announces to ${this.channel}, @channel standy times!`);
}
debugsCode(student, subject) {
console.log(`${this.name} debugs ${student.name}'s code on ${this.subject}`);
}
};
// Example People
let Asha = new Student({
name: 'Asha',
location: 'San Francisco',
age: 20,
favSubjects: 'History',
previousBackground: 'College',
className: 'Lambda'
});
let Archie = new Instructor({
name: 'Archie',
location: 'Riverdale',
age: 15,
favLanguage: 'JavaScript',
specialty: 'Solving Mysteries',
subject: 'fighting crime',
catchPhrase: 'Hiram is bad!'
});
let Betty = new ProjectManager({
name: 'Betty',
location: 'Riverdale',
age: 15,
gradClassName: '2021',
favInstructor: 'Ms. Grundy',
catchPhrase: `Jughead is cool!`,
channel: 'serpents'
});
let Veronica = new Instructor({
name: 'Veronica',
location: 'Riverdale',
age: 16,
favLanguage: 'HTML',
specialty: 'CSS Preprocessing',
catchPhrase: `Archie is great!`
});
// Tests
console.log(Asha);
Asha.speak();
Veronica.speak();
Betty.StandUp();
Archie.demo();