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
146 lines (120 loc) · 3.27 KB
/
Copy pathlambda-classes.js
File metadata and controls
146 lines (120 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
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
// CODE here for your Lambda Classes
class Person {
constructor(props){
this.name = props.name;
this.age= props.age;
this.location = props.location;
this.gender = props.gender;
}
speak() {
console.log (`Hello my name is ${this.name}, I amd from ${this.location}`);
};
}
class Instructor extends Person {
constructor(iprops){
super(iprops);
this.specialty = iprops.specialty;
this.favLanguage = iprops.favLanguage;
this.catchPhrase = iprops.catchPhrase;
}
demo(subject){
console.log (`Today we are learning about ${subject}`);
}
grade(student , subject){
console.log (`${student.name} receives a perfect score on ${subject}`);
}
gradeAdd(student){
let result = (Math.random() + student.grade);
student.grade = result;
console.log(student.grade);
}
gradeSubtract(student){
let result = (student.grade- Math.random());
student.grade = result;
console.log(student.grade);
}
}
class Student extends Person {
constructor(sprops){
super(sprops);
this.previousBackground = sprops.previousBackground;
this.className = sprops.className;
this.favSubjects = sprops.favSubjects.split(' ,');
this.grade = sprops.grade;
}
listSubjects(){
// let fav= this.favSubjects.join(', ');
// console.log(`${this.favSubjects}`)
console.log(this.favSubjects)
};
PRAssignments(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.name} you\'ve graduated`)
} else {console.log (`${this.name} finish your assignments!`)}
}
}
class ProjectManager extends Instructor{
constructor(pmprops){
super(pmprops);
this.gradClassName = pmprops.gradClassName;
this.favInstructor = pmprops.favInstructor;
}
standUp(channel){
console.log(`${this.name} announces to ${channel}, @${channel} standby times! `)
}
debugsCode(student,subject) {
console.log (`${this.name} debugs ${student.name}'s code on ${subject}`);
};
}
const jimbo = new Person ({
name : "Jimbo",
age: 45,
location: "Boston",
gender: 'GQ',
})
jimbo.speak()
const naaz = new Student ({
name : "naaz",
age: 30,
location: "Boston",
gender: 'GQ',
previousBackground: 'Business',
className: 'cs12',
favSubjects: 'somestuff, morestuff, catstuff',
grade: 88,
})
naaz.listSubjects()
naaz.PRAssignments('cc')
naaz.sprintChallenge('JS')
const josh = new Instructor ({
name : "Josh",
age: 40,
location: "cali",
gender: 'M',
specialty: 'tech',
favLanguage: 'JS',
catchPhrase: 'Its not magic',
})
josh.demo('js')
josh.grade(naaz,'js')
const nate = new ProjectManager ({
name : "NateDawg",
age: 13,
location: "boonies",
gender: 'M',
specialty: 'games',
favLanguage: 'JS',
catchPhrase: 'scope is like a limo',
gradClassName: 'CS4?',
favInstructor: "Josh",
})
nate.standUp('cs12_nate');
nate.debugsCode(naaz,'js')
nate.gradeAdd(naaz)
naaz.graduate();