diff --git a/assignments/lambda-classes.js b/assignments/lambda-classes.js index 71acfca0e..f3dc0690e 100644 --- a/assignments/lambda-classes.js +++ b/assignments/lambda-classes.js @@ -1 +1,136 @@ // CODE here for your Lambda Classes +class Person { + constructor(personAttr) { + this.name = personAttr.name; + this.age = personAttr.age; + this.location = personAttr.location; + this.gender = personAttr.gender; + }; + + speak() { + return `Hello my name is ${this.name}, I am from ${this.location}.`; + }; +}; + +class Instructor extends Person { + constructor(instructorAttr) { + super(instructorAttr); + this.specialty = instructorAttr.specialty; + this.faveLanguage = instructorAttr.faveLanguage; + this.catchPhrase = instructorAttr.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(studentAttr) { + super(studentAttr); + this.previousBackground = studentAttr.previousBackground; + this.className = studentAttr.className; + this.favSubjects = studentAttr.favSubjects; + }; + + listSubjects() { + let i = 0; + while (i