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
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ This challenge focuses on classes in JavaScript using the new `class` keyword.

**Follow these steps to set up and work on your project:**

* [ ] Create a forked copy of this project.
* [ ] Add your project manager as collaborator on Github.
* [ ] Clone your OWN version of the repository (Not Lambda's by mistake!).
* [ ] Create a new branch: git checkout -b `<firstName-lastName>`.
* [ ] Implement the project on your newly created `<firstName-lastName>` branch, committing changes regularly.
* [ ] Push commits: git push origin `<firstName-lastName>`.
* [x] Create a forked copy of this project.
* [x] Add your project manager as collaborator on Github.
* [x] Clone your OWN version of the repository (Not Lambda's by mistake!).
* [x] Create a new branch: git checkout -b `<firstName-lastName>`.
* [x] Implement the project on your newly created `<firstName-lastName>` branch, committing changes regularly.
* [x] Push commits: git push origin `<firstName-lastName>`.

**Follow these steps for completing your project.**

* [ ] Submit a Pull-Request to merge <firstName-lastName> Branch into master (student's Repo). **Please don't merge your own pull request**
* [ ] Add your project manager as a reviewer on the pull-request
* [ ] Your project manager will count the project as complete by merging the branch back into master.
* [x] Submit a Pull-Request to merge <firstName-lastName> Branch into master (student's Repo). **Please don't merge your own pull request**
* [x] Add your project manager as a reviewer on the pull-request
* [x] Your project manager will count the project as complete by merging the branch back into master.

## Assignment Description

Expand Down
144 changes: 144 additions & 0 deletions assignments/lambda-classes.js
Original file line number Diff line number Diff line change
@@ -1 +1,145 @@
// CODE here for your Lambda Classes

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

class Instructor extends Person{
constructor (values){
super(values);
this.specialty = values.specialty;
this.favLanguage = values.favLanguage;
this.catchPhrase = values.catchPhrase;
}
demo(subject){
console.log(`Today we are learning about ${subject}`)
}
grade(student, subject){
console.log(`${student.name} receives a perfect score on ${subject}`)
}
}

class Student extends Person{
constructor (values){
super(values);
this.previousBackground = values.previousBackground;
this.className = values.className;
this.favSubjects = values.favSubjects;

}
listsSubjects() {
this.favSubjects.forEach(subject => console.log(`${subject}`));
}
PRAssignment(subject){
return `${this.name} has submitted a PR for ${subject}`
}
sprintChallenge(student, subject){
return `${student.name} has begun sprint challenge on ${subject}`
}
}

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

// Students

const rob = new Student({
name:'Robert',
age: 26,
location:'Sandy, UT',
gender:'M',
previousBackground:`Belly Dancing`,
className:'WebPT5',
favSubjects: ['HTML5', 'CSS3', 'JS'],
});

const cedric = new Student({
name:'Cedric',
age: 22,
location:'Portland, Oregon',
gender:'M',
previousBackground:`Professional Diving`,
className: 'WebPT5',
favSubjects: ['Less', 'Being a GrandWizard'],
});

const dan = new Student({
name:'Dan S',
age: 32,
location:'Seattle Washington',
gender:'M',
previousBackground:`Belly Dancing`,
className: 'WebPT5',
favSubjects: ['Construction', 'Manual Labor'],
});

// New instructor

const brandy = new Instructor({
name:'Brandy R',
age: 29,
location:'Denver Colorado',
gender:'F',
specialty: 'Teaching',
favLanguage:'JavaScript, HTML5',
catchPhrase:'Don\'t Forget the Homies'
});

// New ProjectManager

const marco = new ProjectManager({
name:'Margo G',
age: 35,
location:'California',
gender:'M',
gradClassName: 'CS3',
favInstructor: 'Cam Pope'
});


rob.speak();
cedric.speak();
dan.speak();
brandy.speak();
marco.speak();


brandy.demo();

brandy.grade();


rob.listsSubjects();
cedric.listsSubjects();
dan.listsSubjects();

rob.PRAssignment();
cedric.PRAssignment();
dan.PRAssignment();

rob.sprintChallenge();
cedric.sprintChallenge();
dan.sprintChallenge();

marco.standUp();

marco.debugsCode();
108 changes: 108 additions & 0 deletions assignments/prototype-refactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,111 @@ 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 (args){
this.createdAt = args.createdAt;
this.name = args.name;
this.dimensions = args.dimensions;
}
destroy(){
return ` ${this.name} was removed from the game.`;
}
}


/*
=== CharacterStats ===

*/

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

/*
=== Humanoid (Having an appearance or character resembling that of a human.) ===

*/

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

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

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