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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,4 @@ const fred = new Instructor({
* Add a graduate method to a student.
* This method, when called, will check the grade of the student and see if they're ready to graduate from Lambda School
* If the student's grade is above a 70% let them graduate! Otherswise go back to grading their assignments to increase their score.
...
104 changes: 104 additions & 0 deletions assignments/lambda-classes.js
Original file line number Diff line number Diff line change
@@ -1 +1,105 @@
// CODE here for your Lambda Classes
const mint = new Instructor ({
name: 'fire',
age: 12,
location: 'snellville',
gender: 'male',
favLanguage: 'java',
specialty: 'CSS',
catchPhrase: 'my toe',
});

const pepper = new Student({
name: 'wind',
age: 13,
location: 'dacula',
gender: 'female',
previousBackground: 'none',
className: 'cs4',
favSubjects: 'python',
});

const cumin = new ProjectManagers({
name: 'earth',
age: 12,
location: 'grayson',
gender: 'female',
gradClassName: 'grad15';
favInstructor: 'menubar',
});

const water = new Person ({
name: 'water',
age: 12,
location: 'lawrenceville',
gender: 'male',
});


//Person//
class Person {
constructor(Person) {
this.name = Person.name;
this.age = Person.age;
this.location = Person.location;
this.gender = Person.gender
}
speak() {
return `Hello my name is ${name}, I am from ${location}`;
}
}

//instructor//
class Instructor extends Person {
constructor(Instructor){
super(Instructor);
this.specialty = Instructor.specialty;
this.favLanguage = Instructor.favLanguage;
this.catchPhrase = Instructor.catchPhrase;
}
//insert method//
demo(subject) {
return `Today we are learning about ${subject}`;
}
//insert method//
grade(student, subject) {
return `${student.name} recieves a perfect score on ${subject}`;
}
}

//student//
class Student extends Person {
constructor(Student) {
super(student);
this.previousBackground = student.previousBackground;
this.className = student.className;
this.favSubjects = student.favSubjects;
}
//insert method//
listSubjects() {
return favList = this.favSubjects.map(subject => console.log(subject));
}
PRAssignment() {
return `${name} has submitted a PR for ${subject}`;
}
sprintChallenge() {
return `${name}has begun sprint challenge on ${subject}`;
}
}

//projectmanager//
class ProjectManagers extends Instructor {
constructor(ProjectManagers) {
super(ProjectManagers);
this.gradClassName = ProjectManagers.gradClassName;
this.favInstructor = ProjectManagers.favInstructor;
}
//insert methos//
standUp(channel) {
return `${name} announces to ${channel} @channel standy times!`;
}
debugsCode(student, subject) {
return `${name} debugs ${student}'s code on ${subject}`;

}
}
124 changes: 124 additions & 0 deletions assignments/prototype-refactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,127 @@ 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.

*/

/*
Object oriented design is commonly used in video games. For this part of the assignment you will be implementing several constructor functions with their correct inheritance hierarchy.

In this file you will be creating three constructor functions: GameObject, CharacterStats, Humanoid.

At the bottom of this file are 3 objects that all end up inheriting from Humanoid. Use the objects at the bottom of the page to test your constructor functions.

Each constructor function has unique properties and methods that are defined in their block comments below:
*/

//gameobject//
class GameObject {
constructor(attrs) {
this.createdAt = attrs.createdAt;
this.dimensions = attrs.dimensions;
}
destroy () {
return `${this.name} was removed from the game.`;
}
}



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

}
}

//humanoid//

class Humanoid extends CharacterStats {
constructor(attrs2) {

super(Humanoid);
this.team = attrs2.team;
this.weapons = attrs2.weapons;
this.language = attrs2.language;
}

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


/*
* Inheritance chain: GameObject -> CharacterStats -> Humanoid
* Instances of Humanoid should have all of the same properties as CharacterStats and GameObject.
* Instances of CharacterStats should have all of the same properties as GameObject.
*/

// Test you work by un-commenting these 3 objects and the list of console logs below:


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); // 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.