From d24d6aaf2aee146749ed34bd15e6796d5dd621f6 Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 24 May 2018 17:29:17 -0500 Subject: [PATCH] the assignments was easy, the git was a pain --- .DS_Store | Bin 0 -> 6148 bytes assignments/.DS_Store | Bin 0 -> 6187 bytes assignments/lambda-classes.js | 103 +++++++++++++++++++++++++++++- assignments/prototype-refactor.js | 22 +++---- 4 files changed, 113 insertions(+), 12 deletions(-) create mode 100644 .DS_Store create mode 100644 assignments/.DS_Store mode change 100644 => 100755 assignments/lambda-classes.js diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7c8e0182feabaaebe10ea5f7cd5efa899cf54199 GIT binary patch literal 6148 zcmeHKQESvd5T3nWb#q0$2cdn;i{L{kcY0W%2=Tl=^g$3K`k>M#=4b84sWbo3`kXa;nd~za6aI`C-LA$QmV7;mQ$R(lL!O)>NIz z`ucZS>8v{O-^#c2q{yqf*ZZzoEA7>5*R}5G&W+BS_{hxSI;p4CFqypK+0&#xO1=Hu znBvq<(ii!7w%@(=*pzjWm*a^|&a*K>Ucb!C%*=*nT4t546T1bi10C#lH|Fy}|G{QB z7~EZKhV$+19_)Mf7mGlz-|j!$J2-y-Vg7OP>9eJQ6h3wFEB13>0LZ23sW8< zg0lm9M!WQgM)U-@1v0Z`8r3?YekUJO5n(_W5C$%b0l$suwaY3fb%X(7;L0$-`$Gt2 zj660D?bd<8wgA93+*V-QUw>f84q)W5aR?7Yxm2J_RldbgzH?A69qW;gZydUGQufZM zOT|WPJFYf=BlVm0g2m@D&0o5MGqahy2pRMN} wj?dZXf(i)yF=s089&Ki@XhRK6tJMt zXlBC9<7Q{)X5U@dSpbCge0T^n0W_$BwN088BIBYMa0V6_*ofCn=>kr^|9@a%mR~vp&cJ_S zAk;g(PMa&Ty>)4AvezcmYpRIEeQgKKtD7;SWi#Frp9rH9!_?5*0U^T08Te%ew%!0d C+<)=_ literal 0 HcmV?d00001 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}.`; };