Skip to content

Commit 0eb2e21

Browse files
committed
Got most of it, except the list function. Workign on that next
1 parent e89609b commit 0eb2e21

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed

assignments/lambda-classes.js

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,123 @@
11
// CODE here for your Lambda Classes
2+
3+
class Person{
4+
constructor(personAttr){
5+
this.name = personAttr.name;
6+
this.age = personAttr.age
7+
this.location = personAttr.location;
8+
this.gender = personAttr.gender;
9+
}
10+
speak(){
11+
return `Hello my name is ${this.name}, I am from ${this.location}`
12+
}
13+
}
14+
15+
16+
class Instructor extends Person{
17+
constructor(instrAttr){
18+
super(instrAttr)
19+
this.specialty = instrAttr.specialty;
20+
this.favLanguage = instrAttr.favLanguage;
21+
this.catchPhrase = instrAttr.catchPhrase;
22+
}
23+
demo(subject){
24+
return `Today we are learning about ${subject}`
25+
}
26+
grade(student,subject){
27+
return `${student.name} recieves a perfect score on ${subject}`
28+
}
29+
}
30+
31+
const fred = new Instructor({
32+
name: 'Fred',
33+
location: 'Bedrock',
34+
age: 37,
35+
gender: 'male',
36+
favLanguage: 'JavaScript',
37+
specialty: 'Front-end',
38+
catchPhrase: `Don't forget the homies`
39+
});
40+
41+
42+
43+
class Student extends Person{
44+
constructor(studAttr){
45+
super(studAttr)
46+
this.previousBackground = studAttr.previousBackground;
47+
this.className = studAttr.className;
48+
this.favSubjects = studAttr.favSubjects;
49+
}
50+
listSubjects(){
51+
return (this.favSubjects)
52+
53+
}
54+
PRAssignment(subject){
55+
return `${this.name} has begun spring challenge on ${subject}`
56+
}
57+
}
58+
59+
const bambam = new Student({
60+
name: 'Bam Bam',
61+
location: 'Bedrock',
62+
age: 9,
63+
gender: 'male',
64+
previousBackground: 'bangin everthing',
65+
className:'4th Grade',
66+
favSubjects: ['jerking one out','hitting it raw','pushing the turd thru']
67+
});
68+
69+
class ProjectManager extends Instructor{
70+
constructor(pmAttr){
71+
super(pmAttr)
72+
this.gradeClassName = pmAttr.gradeClassName;
73+
this.favInstructor = pmAttr.favInstructor;
74+
}
75+
standUp(channel){
76+
return `${this.name} announces to ${channel},@channel standy times!`
77+
}
78+
debugsCode(student,subject){
79+
return `${this.name} debugs ${student.name}'s code on ${subject}`
80+
}
81+
}
82+
83+
const perry = new ProjectManager({
84+
name: 'Perry A',
85+
location: 'Strong Island',
86+
age: 45,
87+
gender: 'male',
88+
favLanguage: 'JavaScript',
89+
specialty: 'Front-end',
90+
catchPhrase: `Don't worry about it...`,
91+
gradeClassName : "C11",
92+
favInstructor : 'Josh Nelly'
93+
})
94+
95+
//Testing Instructor - Fred
96+
console.log(fred.name)
97+
console.log(fred.location)
98+
console.log(fred.age)
99+
console.log(fred.gender)
100+
console.log(fred.favLanguage)
101+
console.log(fred.specialty)
102+
console.log(fred.catchPhrase)
103+
console.log(fred.demo('hittin it raw'))
104+
console.log(fred.grade(bambam,'hittin it raw'))
105+
106+
//Testing Student - Bam Bam
107+
console.log(bambam.name)
108+
console.log(bambam.location)
109+
console.log(bambam.age)
110+
console.log(bambam.gender)
111+
console.log(bambam.previousBackground)
112+
console.log(bambam.className)
113+
console.log(bambam.favSubjects)
114+
115+
//********** List is not really working *************
116+
bambam.listSubjects()
117+
console.log(bambam.PRAssignment('hitting it raw'))
118+
119+
//Testing PM
120+
console.log(perry.gradeClassName)
121+
console.log(perry.favInstructor)
122+
console.log(perry.standUp('cs11'))
123+
console.log(perry.debugsCode(bambam,'hitting it raw'))

0 commit comments

Comments
 (0)