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
139 lines (131 loc) · 3.59 KB
/
Copy pathlambda-classes.js
File metadata and controls
139 lines (131 loc) · 3.59 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
// CODE here for your Lambda Classes
class Person
{
constructor(personalInformation)
{
this.name = personalInformation.name;
this.age = personalInformation.age;
this.location = personalInformation.location;
this.gender = personalInformation.gender;
}
speak()
{
console.log(`Hello my name is ${this.name}, I am from ${this.location}`);
}
}
class Instructor extends Person
{
constructor(instructorInformation)
{
super(instructorInformation);
this.specialty = instructorInformation.specialty;
this.favLanguage = instructorInformation.favLanguage;
this.catchPhrase = instructorInformation.catchPhrase;
}
demo(subject)
{
console.log(`Today we are learning about ${subject}`);
}
grade(student, subject)
{
console.log(`${student.name} receives a perfect score on ${subject}`);
}
randomPoints(student)
{
let randomNumber = Math.floor(Math.random()*10)-3;
student.grade -= randomNumber;
}
}
class Student extends Person
{
constructor(studentInformation)
{
super(studentInformation);
this.previousBackground = studentInformation.previousBackground;
this.className = studentInformation.className;
this.favSubjects = studentInformation.favSubjects;
this.grade = 50;
}
listsSubjects()
{
this.favSubjects.forEach(subject => console.log(subject));
}
PRAssignment(subject)
{
console.log(`${this.name} has begun sprint challenge on ${subject}`);
}
graduate()
{
if(this.grade>70)
{
console.log(`${this.name} is ready to graduate.`);
}
else
{
console.log(`Go back to grading ${this.name}'s assignments.`);
}
}
}
class ProjectManager extends Instructor
{
constructor(pMInfo)
{
super(pMInfo);
this.gradClassName = this.pMInfo;
this.favInstructor = this.pMInfo;
}
standUp(slackChannel)
{
console.log(`${this.name} announces to ${slackChannel}, @channel standy times!`);
}
debugsCode(student, subject)
{
console.log(`${this.name} debugs ${student.name}'s code on ${subject}`);
}
}
//tests
// const kev = new Student(
// {
// name: 'Kevin Nguyen',
// age: 25,
// location: 'Hayward, CA, USA',
// gender: 'male',
// previousBackground: 'Information Technology',
// className: 'CS13',
// favSubjects: ['javascript', 'OOP', 'C', 'Data Structures', 'Algorithms'],
// }
// )
// kev.speak();
// kev.graduate();
// kev.listsSubjects;
// kev.PRAssignment('javascript');
// const josh = new Instructor(
// {
// name: 'Josh Knell',
// age: 28,
// location: 'Central United States',
// gender: 'male',
// specialty: 'Web Development',
// favLanguage:'less',
// catchPhrase: `I'm Detective Hopper!`,
// }
// );
// josh.speak();
// josh.demo('javascript');
// josh.grade(kev, 'Responsive Web Design');
// const zack = new ProjectManager(
// {
// name: 'Zack Hitchcock',
// age: '27',
// location: 'Bay Area, CA, USA',
// gender: 'male',
// specialty: 'project managing',
// favLanguage: 'javascript',
// catchPhrase: `The problem is not the problem, the problem is your attitude about the problem.`,
// favInstructor: josh,
// }
// )
// zack.speak();
// zack.randomPoints(kev);
// zack.standUp('cs13_zack');
// zack.debugsCode(kev, 'Javascript Prototypes');