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
134 lines (130 loc) · 3.73 KB
/
Copy pathlambda-classes.js
File metadata and controls
134 lines (130 loc) · 3.73 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
// CODE here for your Lambda Classes
class Person{
constructor(attributes){
this.name = attributes.name;
this.age = attributes.age;
this.location = attributes.location;
this.gender = attributes.gender;
}
speak(){
return `Hello my ${this.name}, I am from ${this.location}`;
}
}
class Instructor extends Person{
constructor(instructorAttributes){
super(instructorAttributes);
this.specialty = instructorAttributes.specialty;
this.favLanguage = instructorAttributes.favLanguage;
this.catchPhrase = instructorAttributes.catchPhrase;
}
demo(subject){
return `Today we are learning about ${subject}`;
}
grade(student, subject){
return `${student.name} receives a perfect score on ${subject}`
}
}
class Student extends Person{
constructor(studentAttributes){
super(studentAttributes);
this.previousBackground = studentAttributes.previousBackground;
this.className = studentAttributes.className;
this.favSubjects = studentAttributes.favSubjects;
}
listSubjects(){
return `${this.name}'s favorite subjects are ${this.favSubjects}`;
}
PRAssignment(subject){
return `${this.name} has submitted a PR for ${subject}`;
}
sprintChallenge(subject){
return `${this.name} has begun sprint challenge on ${subject}`;
}
}
class ProjectManager extends Instructor{
constructor(PmAttributes){
super(PmAttributes);
this.gradClassName = PmAttributes.gradClassName;
this.favInstructor = PmAttributes.favInstructor;
}
standUp(slackChannel){
return `${this.name} announces to ${slackChannel}, @${slackChannel} standy times!`
}
debugsCode(student, subject){
return `${this.name} debugs ${student.name} code on ${subject}`
}
}
//Instructor Objects
const andrew = new Instructor({
name: "Andrew Mendez",
age: "38",
location: "Australia",
gender: "Male",
specialty: "React",
favLanguage: "JavaScript",
catchPhrase: "Don't forget the homies!"
});
const aaron = new Instructor({
name: "Aaron Swartz",
age: "27",
location: "New York",
gender: "Male",
specialty: "Python",
favLanguage: "C++",
catchPhrase: "IDKKK!!!"
});
const sarah = new Instructor({
name: "Sarah Vega",
age: "31",
location: "Spain",
gender: "Female",
specialty: "C",
favLanguage: "C#",
catchPhrase: "Idk!!!!"
});
//Student Objects
const richard = new Student({
name: "Richard Velasco",
age: "20",
location: "Louisiana",
gender: "Male",
previousBackground: "Real Estate Broker",
className: "CS40",
favSubjects:["Flexbox", "JavaScript", "Python"]
});
const ana = new Student({
name: "Ana Hoffman",
age: "19",
location: "California",
gender: "Female",
previousBackground: "College Student",
className: "CS30",
favSubjects: ["JavaScript", "C"]
});
//Project Manager Objects
const kevin = new ProjectManager({
name: "Kevin Hart",
age: "39",
location: "Philadelphia",
gender: "Male",
gradClassName:"CS8",
favInstructor: "Aaron Swartz"
});
const robin = new ProjectManager({
name: "Robin Haney",
age: "26",
location: "Florida",
gender: "Male",
gradClassName: "CS9",
favInstructor: "Sarah Vega"
});
//=====TEST=====
// console.log(robin.name);
// console.log(`Favorite Instructor: ${robin.favInstructor}`);
// console.log(kevin.standUp("FSW78"));
// console.log(kevin.debugsCode(ana, "Python"));
// console.log(sarah.demo("JavaScript"));
// console.log(richard.favSubjects);
// console.log(ana.listSubjects());
// console.log(richard.PRAssignment("Python"));
// console.log(ana.sprintChallenge("Flexbox"));