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
124 lines (111 loc) · 2.84 KB
/
Copy pathlambda-classes.js
File metadata and controls
124 lines (111 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// CODE here for your Lambda Classes
class Person {
constructor(attrs) {
this.name = attrs.name;
this.age = attrs.age;
this.location = attrs.location;
this.gender = attrs.gender;
}
speak() {
console.log(`Hello my name is ${this.name}, I am from {this.location}`);
}
}
class Instructor extends Person {
constructor(instAttrs) {
super(instAttrs);
this.specialty = instAttrs.specialty;
this.favLanguage = instAttrs.favLanguage;
this.catchPhrase = instAttrs.catchPhrase;
}
demo(subject) {
console.log(`Today we are learning about ${subject}`);
}
grade(student, subject) {
console.log(`${student} receives a perfect score on ${subject}`);
}
gradeStud(obj) {
obj.grade = Math.floor(Math.random() * Math.floor(100));
console.log(obj.grade);
}
}
class Student extends Person {
constructor(stAtrrs) {
super(stAtrrs);
this.previousBackground = stAtrrs.previousBackground;
this.className = stAtrrs.className;
this.favSubjects = stAtrrs.favSubjects;
this.grade = stAtrrs.grade;
}
listsSubjects() {
this.favSubjects.forEach(element => console.log(element));
}
PRAssignment(subject) {
console.log(`${this.name} has submitted a PR for ${subject}`);
}
sprintChallenge(subject) {
console.log(`${this.name} has begun sprint challenge on ${subject}`);
}
graduate() {
if (this.grade >= 70) {
console.log((this.grade = "graduated!"));
} else {
console.log(this.grade);
}
}
}
class ProjectManager extends Instructor {
constructor(pmAttrs) {
super(pmAttrs);
this.gradClassName = pmAttrs.gradClassName;
this.favInstructor = pmAttrs.favInstructor;
}
standUp(channel) {
console.log(
`${this.name} announces to ${channel}, @channel standy times!`
);
}
debugsCode(obj, subject) {
console.log(`${this.name} debugs ${obj.name}'s code on ${subject}`);
}
}
//Testing Instructor code
const fred = new Instructor({
name: "Fred",
location: "Bedrock",
age: 37,
gender: "male",
favLanguage: "JavaScript",
specialty: "Front-end",
catchPhrase: `Don't forget the homies`
});
fred.demo("JS");
fred.grade("Fritz", "JavaScript");
//Testing Student code
const fritz = new Student({
name: "Fritz",
location: "Jacsonville",
age: 34,
gender: "male",
previousBackground: "Tier 2 Tech support",
className: "WEBPT5",
favSubjects: ["Html", "CSS", "JavaScript"],
grade: 95
});
fritz.listsSubjects();
fritz.PRAssignment("CSS");
fritz.sprintChallenge("JavaScript");
//Testing ProjectManager code
const alex = new ProjectManager({
name: "Alex",
location: "UT",
age: 25, //Trying to guess lol
gender: "male",
gradClassName: "WEB1",
favInstructor: "Pope"
});
alex.standUp("WEBPT5");
alex.debugsCode(fritz, "HTML");
// Stretch Problem
fred.gradeStud(fritz);
alex.gradeStud(fritz);
fritz.graduate();