Skip to content

MVP #689

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

MVP #689

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
169 changes: 169 additions & 0 deletions assignments/lambda-classes.js
Original file line number Diff line number Diff line change
@@ -1 +1,170 @@
// CODE here for your Lambda Classes
class Person{
constructor(atts){
this.name = atts.name;
this.age = atts.name;
this.location = atts.location;
this.subject = atts.subject;
}
speak(){
return `Hello my name is ${this.name}, I am from the ${this.location}!`
}
}

class Student extends Person{
constructor(atts){
super(atts);
this.previousBackground = atts.previousBackground;
this.className = atts.className;
this.favSubjects = atts.favSubjects;
}
listsSubjects(){
return `These are my favorite subjects - ${this.favSubjects}!`
}
prAssignment(){
return `${this.name} has submitted a PR for ${this.subject}!`
}
sprintChallenge(){
return `${this.name} has begun sprint challenge on ${this.subject}!`
}
}

class Instructor extends Person{
constructor(atts){
super(atts);
this.specialty = atts.specialty;
this.favLanguage = atts.favLanguage;
this.catchPhrase = atts.catchPhrase;

}
demo(){
return `Today we are learning about ${this.subject}!`
}
grade(){
return `${Student.name} receives a perfect score on ${this.subject}!`
}
}

class ProjectManager extends Instructor{
constructor(atts){
super(atts);
this.gradClassName = atts.gradClassName;
this.favInstructor = atts.favInstructor;
this.channel = atts.channel;
}
standUp(){
return `${this.name} announces to ${this.channel}, @channel standy times!`
}
debugsCode(){
return `${this.name} debugs ${Student.name}'s code on ${this.subject}!`
}
}


const james = new Person({
name: "James",
age: 33,
location: "USA",
subject: "biology"

})

console.log(james.speak());

const emily = new Person({
name: "Emily",
age: 33,
location: "Austrailia",
subject: "biology"

})

// console.log(emily.speak());

const brit = new Instructor({
name: "Brit",
age: 25,
location: "USA",
subject: "Classes",
specialty: "Web Development",
favLanguage: "JS",
catchPhrase: "AYEEE IM CANADIAN!"

})

console.log(brit.demo());
console.log(brit.grade());

const jordan = new Instructor({
name: "Jordan",
age: 25,
location: "USA",
subject: "Classes",
specialty: "Web Development",
favLanguage: "JS",
catchPhrase: "AYEEE IM CANADIAN!"

})

// console.log(jordan.demo());
// console.log(jordan.grade());

const josh = new Student({
name: "Josh",
age: 22,
location: "USA",
subject: "Classes",
previousBackground: "College Student",
className: "WEB25",
favSubjects: "JavaScript, HTML, CSS"
})
console.log(josh.listsSubjects());
console.log(josh.prAssignment());
console.log(josh.sprintChallenge());

const brendan = new Student({
name: "Brendan",
age: 22,
location: "USA",
subject: "Classes",
previousBackground: "College Student",
className: "WEB25",
favSubjects: "JavaScript, HTML, CSS"
})

// console.log(brendan.listsSubjects())
// console.log(brendan.prAssignment())
// console.log(brendan.sprintChallenge())

const roenz = new ProjectManager({
name: "Roenz",
age: 26,
location: "USA",
subject: "Classes",
specialty: "Web Development",
favLanguage: "JS",
catchPhrase: "MACHINE LEARNING!",
gradClassName: "WEB20??",
favInstructor: "BRITTTTTT",
channel: "the slack channel WEB_25_ROENZ"
})

console.log(roenz.standUp());
console.log(roenz.debugsCode());


const ryan = new ProjectManager({
name: "Ryan",
age: 26,
location: "USA",
subject: "Classes",
specialty: "Web Development",
favLanguage: "JS",
catchPhrase: "MACHINE LEARNING!",
gradClassName: "WEB20??",
favInstructor: "BRITTTTTT",
channel: "the slack channel WEB_25_RYAN"
})

// console.log(ryan.standUp());
// console.log(ryan.debugsCode());
127 changes: 127 additions & 0 deletions assignments/prototype-refactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,130 @@ Prototype Refactor
2. 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.

*/

class GameObject {
constructor(attributes){
this.createdAt = attributes.createdAt;
this.name = attributes.name;
this.dimensions = attributes.dimensions;

}
destroy(){
return `${this.name} was removed from the game.`;
}
}

class CharacterStats extends GameObject{
constructor(attributes){
super(attributes);
this.healthPoints = attributes.healthPoints;
}
takeDamage(){
return `${this.name} took damage.`;
}
}

class Humanoid extends CharacterStats{
constructor(attributes) {
super(attributes);
this.team = attributes.team;
this.weapons = attributes.weapons;
this.language = attributes.language;

}
greet(){
return `${this.name} offers a greeting in ${this.language}`;
}
}

// function GameObject(attributes){
// this.createdAt = attributes.createdAt;
// this.name = attributes.name;
// this.dimensions = attributes.dimensions;

// }
// GameObject.prototype.destroy = function(){
// return `${this.name} was removed from the game.`;
// }


// function CharacterStats(attributes){
// this.healthPoints = attributes.healthPoints;
// GameObject.call(this, attributes);
// }
// CharacterStats.prototype = Object.create(GameObject.prototype)

// CharacterStats.prototype.takeDamage = function (){
// return `${this.name} took damage.`;
// }


// function Humanoid(attributes){
// this.team = attributes.team;
// this.weapons = attributes.weapons;
// this.language = attributes.language;
// CharacterStats.call(this, attributes);
// }
//


const mage = new Humanoid({
createdAt: new Date(),
dimensions: {
length: 2,
width: 1,
height: 1,
},
healthPoints: 5,
name: 'Bruce',
team: 'Mage Guild',
weapons: [
'Staff of Shamalama',
],
language: 'Common Tongue',
});

const swordsman = new Humanoid({
createdAt: new Date(),
dimensions: {
length: 2,
width: 2,
height: 2,
},
healthPoints: 15,
name: 'Sir Mustachio',
team: 'The Round Table',
weapons: [
'Giant Sword',
'Shield',
],
language: 'Common Tongue',
});

const archer = new Humanoid({
createdAt: new Date(),
dimensions: {
length: 1,
width: 2,
height: 4,
},
healthPoints: 10,
name: 'Lilith',
team: 'Forest Kingdom',
weapons: [
'Bow',
'Dagger',
],
language: 'Elvish',
});

console.log(mage.createdAt); // Today's date
console.log(archer.dimensions); // { length: 1, width: 2, height: 4 }
console.log(swordsman.healthPoints); // 15
console.log(mage.name); // Bruce
console.log(swordsman.team); // The Round Table
console.log(mage.weapons[0]); // Staff of Shamalama
console.log(archer.language); // Elvish
console.log(archer.greet()); // Lilith offers a greeting in Elvish.
console.log(mage.takeDamage()); // Bruce took damage.
console.log(swordsman.destroy()); // Sir Mustachio was removed from the game.