diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 000000000..7c8e0182f Binary files /dev/null and b/.DS_Store differ diff --git a/assignments/.DS_Store b/assignments/.DS_Store new file mode 100644 index 000000000..4260b8b23 Binary files /dev/null and b/assignments/.DS_Store differ diff --git a/assignments/lambda-classes.js b/assignments/lambda-classes.js old mode 100644 new mode 100755 index 71acfca0e..875aed010 --- a/assignments/lambda-classes.js +++ b/assignments/lambda-classes.js @@ -1 +1,102 @@ -// 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 name is ${this.name} I am from ${this.location}`; +} +}//end person + +class Instructor extends Person { + constructor(attributes) { + super(attributes); + this.favLanguage = attributes.favLanguage; + this.specialty = attributes.specialty; + this.catchPhrase = attributes.catchPhrase; +} +demo(){ + return `Today we are learning about ${this.subject}`; +} +grade(){ + `Student ${student.name} recieves a perfect score on ${this.subject}`; + +} +}//ends instructor + +class Student extends Person { + constructor(attributes){ + super (attributes); + this.previousBackground = attributes.previousBackground; + this.className = attributes.className; + this.favSubjects = attributes.favSubjects; + +} +listSubjects(){ +function subject(list){ + +} +} +//this.favSubject.forEach(subject); +//console.log(subject); +PRAssignment(){ +return `${student.name} has submitted a PR for ${this.subject}`; +} +sprintChallenge(){ +return `${student.name} has begun the Sprint Challenge`; +} +} + +class PM extends Instructor { + constructor(attributes) { + super(attributes); + this.gradClass = attributes.gradClass; + this.favInstructor = attributes.favInstructor; + +} +standup() { +return `${PM.name} announces to ${channel} @channel standup times!`; +} +debugsCode(){ +return `${PM.name} debugs ${student.name}'s code on ${this.subject}`; + +} +}// ends instructor + +const brynne = new Student({ + "name" : 'Brynne', + "age" : 21, + "location" : 'Small Town', + "gender" : 'female', +"previousBackground" : 'Medical', +"className" : 'CS15', +"favSubjects" : ["Javascript","CSS","HTML"], +}); + +const fred = new Instructor({ + "name": 'Fred', + "location": 'Bedrock', + "age": 37, + "gender": 'male', + "favLanguage": 'JavaScript', + "specialty": 'Front-end', + "catchPhrase": `Super-Powerful` +}); + +const kigh = new PM ({ + "name" : 'Kigh', + "age" : 47, + "location" : 'Texas', + "gender" : 'female', + "gradClass" : 2008, + "favInstructor" : 'Professor', + "favLanguage": 'JavaScript', + "specialty": 'Front-end', + "catchPhrase": `Awesome!` +}); + +console.log(brynne); +console.log(kigh); +console.log(fred); diff --git a/assignments/prototype-refactor.js b/assignments/prototype-refactor.js index e55ae39c0..fa3875802 100644 --- a/assignments/prototype-refactor.js +++ b/assignments/prototype-refactor.js @@ -2,37 +2,37 @@ // Today your goal is to refactor all of this code to use ES6 Classes. // The console.log() statements should still return what is expected of them. -function GameObject(options) { +class GameObject(options) { + constructor(options){ this.createdAt = options.createdAt; this.dimensions = options.dimensions; } - -GameObject.prototype.destroy = function() { +} +destroy() { return `Object was removed from the game.`; }; -function CharacterStats(characterStatsOptions) { - GameObject.call(this, characterStatsOptions); +class CharacterStats(characterStatsOptions) { + super(characterStatsOptions); this.hp = characterStatsOptions.hp; this.name = characterStatsOptions.name; } -CharacterStats.prototype = Object.create(GameObject.prototype); -CharacterStats.prototype.takeDamage = function() { +takeDamage() { return `${this.name} took damage.`; }; -function Humanoid(humanoidOptions) { - CharacterStats.call(this, humanoidOptions); +class Humanoid(humanoidOptions) { +super(humanoidOptions); this.faction = humanoidOptions.faction; this.weapons = humanoidOptions.weapons; this.language = humanoidOptions.language; } -Humanoid.prototype = Object.create(CharacterStats.prototype); -Humanoid.prototype.greet = function() { + +greet() { return `${this.name} offers a greeting in ${this.language}.`; };