Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

completed MVP #675

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
90 changes: 90 additions & 0 deletions assignments/lambda-classes.js
Original file line number Diff line number Diff line change
@@ -1 +1,91 @@
// CODE here for your Lambda Classes
'use strict';
class Person{
constructor(atts){
this.name = atts.name
this.age = atts.age,
this.location = atts.location;
}
speak(){
return `Hello my name is ${this.name}, I am from ${this.location}.`
}
}

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

class Student extends Person{
constructor(attx){
super(attx);
this.previouseBackground = attx.previouseBackground,
this.className = attx.className,
this.favSubjects = attx.favSubjects;
this.prSubject = attx.prSubject,
this.sprintSubject = attx.sprintSubject
}
listSubjects(){
return(this.favSubjects)
}
PRAssignment(){
return(`${this.name} has submitted a PR for ${this.prSubject}.`)
}
sprintChallenge(){
return (`${this.name} has begun sprint challenge on ${this.sprintSubject}.`)
}
}

class ProjectManager extends Instructor{
constructor(attz){
super(attz);
this.gradClassName = attz.gradClassName,
this.favInstructor = attz.favInstructor,
this.channel = attz.channel,
this.studentName = attz.studentName,
this.subject = attz.subject;

};
standUp(){
return(`${this.name} announces to ${this.channel}, @channel standy times!`)
}
debugsCode(){
return(`${this.name} debugs ${this.studentName}'s code on ${this.subject}.`)
}

}

const aasa = new Student({
name: 'Aasa',
age: 30,
location: 'Virginia',
previouseBackground: 'Doctor',
className: "Web24",
favSubjects: 'math, science, english',
prSubject: 'JavaScript IV',
sprintSubject: 'Advanced CSS'

});

const tom = new ProjectManager({
name: 'Thomas',
studentName: 'Aasa',
subject: 'advanced CSS'

});

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

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

};
}

class Humanoid extends CharacterStats{
constructor(attx){
super(attx);
this.team = attx.team,
this.weapons = attx.weapons,
this.language = attx.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.


// Stretch task:
// * Create Villain and Hero constructor functions that inherit from the Humanoid constructor function.
// * Give the Hero and Villains different methods that could be used to remove health points from objects which could result in destruction if health gets to 0 or drops below 0;
// * Create two new objects, one a villain and one a hero and fight it out with methods!