Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added assignments/.DS_Store
Binary file not shown.
103 changes: 102 additions & 1 deletion assignments/lambda-classes.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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);
22 changes: 11 additions & 11 deletions assignments/prototype-refactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}.`;
};

Expand Down