-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathlambda-classes.js
More file actions
121 lines (108 loc) · 3.27 KB
/
lambda-classes.js
File metadata and controls
121 lines (108 loc) · 3.27 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
// 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(attributes) {
super(attributes);
this.specialty = attributes.specialty,
this.favLanguage = attributes.favLanguage,
this.catchPhrase = attributes.catchPhrase,
this.gradingScale = attributes.gradingScale
}
demo() {
return (`Today we are learning about ${this.specialty}`)
}
grade() {
return (`${this.name} receives a perfect score on ${this.specialty}`);
}
}
class Students extends Person {
constructor(studentAttributes) {
super(studentAttributes);
this.previousBackground = studentAttributes.previousBackground,
this.classname = studentAttributes.classname,
this.favSubjects = studentAttributes.favSubjects
this.gradingScale = studentAttributes.gradingScale
}
listsSubjects() {
return ['HTML', 'CSS', 'JavaScript']
}
prassignment() {
return (`${this.name} has submitted a PR for ${this.specialty}`)
}
sprintChallenge() {
return (`${this.name} has begun sprint challenge on ${this.specialty} `);
}
score() {
if (this.gradingScale >= 70) {
return `Congratulations, you have graduated!`;
}
return `Still grading to determine if passing.`;
}
}
class Projectmanagers extends Instructor {
constructor(pmAttributes) {
super(pmAttributes);
this.gradClassName = pmAttributes.gradClassName,
this.favInstructor = pmAttributes.favInstructor,
this.channel = pmAttributes.channel
}
standUp() {
return (`${this.name} announces to ${this.channel}, @channel standby times!`)
}
debugsCode() {
return (`${this.name} debugs ${this.name}'s code on ${this.specialty}`)
}
}
const user = new Person({
name: 'Fred',
age: 45,
location: 'Bedrock',
catchPhrase: `it is what it is`
});
const student = new Students({
name: 'Jane',
location: 'Tampa',
age: 25,
favLanguage: 'JavaScript',
specialty: 'CSS',
previousBackground: 'teacher',
classname: 'Web24',
favSubjects: ['HTML', 'CSS', 'JavaScript'],
gradingScale: Math.floor(Math.random() * 100) + 1
});
const instruct = new Instructor({
name: 'Tina',
location: 'Utah',
age: 34,
favLanguage: 'HTML',
specialty: 'React',
catchPhrase: `Don't forget the homies`
});
const projectMag = new Projectmanagers({
name: 'Tom',
location: 'San Francisco',
age: 34,
favLanguage: 'JavaScript',
specialty: 'Front-end',
catchPhrase: `Don't forget the homies`,
channel: 'Web24'
});
console.log(user.speak());
console.log(instruct.demo());
console.log(instruct.grade());
console.log(student.listsSubjects());
console.log(student.prassignment());
console.log(student.sprintChallenge());
console.log(projectMag.standUp());
console.log(projectMag.debugsCode());
console.log(student.gradingScale);
console.log(student.score());