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
187 lines (165 loc) · 4.81 KB
/
Copy pathlambda-classes.js
File metadata and controls
187 lines (165 loc) · 4.81 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
// CODE here for your Lambda Classes
//===PERSON CLASS===//
class Person {
constructor(options) {
this.name = options.name;
this.age = options.age;
this.location = options.location;
this.gender = options.age;
}
speak(){
console.log(`Hello my name is ${this.name}, I am from ${this.location}`);
}
}
//===INSTRUCTOR CLASS===//
class Instructor extends Person{
constructor(instructorOptions){
super(instructorOptions);
this.specialty = instructorOptions.specialty;//what the insructor is good at
this.favLanguage = instructorOptions.favLanguage;
this.catchPhrase = instructorOptions.catchPhrase;
}
demo(subject){
console.log(`Today we are learning about ${this.subject}`);
}
grade(student, subject){
console.log(`${student.name} receives a perfect score on ${subject}`);
}
gradeChanger(student){
student.grade = Math.floor(Math.random() * 100 + student.grade);
return student.grade;
}
}
//===STUDENT CLASS===//
class Student extends Person {
constructor(studentOptions){
super(studentOptions);
this.previousBackground = studentOptions.previousBackground; //what Student used to do before Lambda School
this.className = studentOptions.className; //i.e CS132
this.favSubjects = studentOptions.favSubjects;
this.grade = studentOptions.grade;
}
listsSubjects(){
this.favSubjects.forEach(element => {
console.log(element);
});
}
PRAssignment(subject){
console.log(`${this.name} has begun spring challenge on ${subject}`);
}
graduate(){
if(this.grade > .7) {
return `${this.name} graduates from Lambda School!`;
}
}
}
//===PROJECT MANAGER CLASS===//
class ProjectManager extends Instructor{
constructor(projectManagerOptions){
super(projectManagerOptions);
this.gradClassName = projectManagerOptions.gradClassName;
this.favInstructor = projectManagerOptions.favInstructor;
}
standUp(channel){
console.log(`${this.name} announces to ${channel}, @channel standy times!`);
}
debugsCode(student, subject){
console.log(`${this.name} debugs ${student.name}'s code on ${subject}`);
}
}
const instructor1 = new Instructor({
name: 'Joaquin',
age: 345,
location: 'Foon',
gender: 'male',
specialty: 'Soup making',
favLanguage: 'Squendarlian',
catchPhrase: 'You\'ll never see these beets again!'
});
const instructor2 = new Instructor({
name: 'Celadore',
age: 25,
location: 'Foon',
gender: 'male',
specialty: 'Flying like a bird',
favLanguage: 'Masquich',
catchPhrase: 'Caroocoocachoo!'
});
const instructor3 = new Instructor({
name: 'Mastofina',
age: 1999,
location: 'Foon',
gender: 'female',
specialty: 'Laptop repair',
favLanguage: 'Faldonian',
catchPhrase: 'Party like it\'s 1999!'
});
const student1 = new Student({
name: 'Mexican Pete',
age: 2,
location: 'Foon',
gender: 'male',
previousBackground:'Used to fight the steel dwarves on the planet Macktoo.' ,
className:'CS12' ,
favSubjects:['JavaScript', 'HTML'],
grade: 97
});
const student2 = new Student({
name: 'Frenchy Franchesca',
age: 7,
location: 'Foon',
gender: 'female',
previousBackground:'Used to teach the Zobdarts how to bobblefingle.' ,
className:'CS12' ,
favSubjects:['CSS', 'HTML' , 'C++'],
grade: 65
});
const student3 = new Student({
name: 'Spanish Jane',
age: 4,
location: 'Foon',
gender: 'female',
previousBackground:'Used to train elephants in the circus.' ,
className:'CS12',
favSubjects:['C++', 'Python', 'JavaScript', 'CSS'],
grade: 42
});
const projectManager1 = new ProjectManager({
name: 'Mr. Socks',
age: 75,
location: 'Foon',
gender: 'male',
specialty: 'Knitting',
favLanguage: 'Faldonian',
catchPhrase: 'SOCKS IN A BOX ARE SOCKS THAT ROCKS!',
gradClassName: 'CS2',
favInstructor: 'Mastofina'
});
const projectManager2 = new ProjectManager({
name: 'Mrs. Wallabee',
age: 76,
location: 'Foon',
gender: 'female',
specialty: 'Drawing Cats',
favLanguage: 'Faldonian',
catchPhrase: 'I want mine . . . all the way!',
gradClassName: 'CS4',
favInstructor: 'Celadore'
});
const projectManager3 = new ProjectManager({
name: 'Mr. Waffles',
age: 83,
location: 'Foon',
gender: 'male',
specialty: 'Skyrocketing',
favLanguage: 'Squendarlian',
catchPhrase: 'Pour on the syrup!',
gradClassName: 'CS1',
favInstructor: 'Celadore'
});
console.log(instructor1.name);
console.log(instructor2.grade(student1, 'Javascript'));
console.log(projectManager3.debugsCode(student2,'HTML'));
console.log(student2.listsSubjects());
console.log(instructor1.gradeChanger(student2));
console.log(student2.graduate());