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
123 changes: 123 additions & 0 deletions assignments/lambda-classes.js
Original file line number Diff line number Diff line change
@@ -1 +1,124 @@
// CODE here for your Lambda Classes
class Person {
constructor(info) {
this.name = info.name;
this.age = info.age;
this.location = info.location;
}

speak() {
return `Hello my name is ${this.name}, I am from ${this.location}!`;
}
}

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

demo(subj) {
return `Today we are learning about ${subj}!`;
}

// Grade method here
grade(student, subject) {
return `${student} receives a perfect score on a ${subject}`;
}

}

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

listSubjects() {
console.log('list of favorite subjects:');
this.favSubjects.forEach((subject, index) => console.log(`${index + 1}: ${subject}`));
}

PRassignment(subject) {
return `${this.name} has submitted a PR for ${subject}`;
}

sprintChallenge(subject) {
return `${this.name} has begun sprint challenge on ${subject}`;
}


// Random grading here
gradeRandom(student, subject) {
this.grade = Math.floor(Math.random() * 100);
return `${student}, total grade is ${this.grade} on his ${subject}`;
}

graduate() {
if(this.grade < 70) {
return 'Please continue to work in your projects';
}
else {
return `Congratulations! You are done with Lambda School! Your grade is: ${this.grade}`;;
}
}

}

class ProjectManager extends Instructor {
constructor(info) {
super(info);
this.gradClassName = info.className;
this.favInstructor = info.favInstructor;
}

standup(slackChannel) {
return `${this.name} announces to ${slackChannel}, @channel standy times!`;
}

debugsCode(student, subject) {
return `${this.name} debugs ${student}'s code on ${subject}`;
}
}

const dan = new Instructor({
name: 'Dan',
age: 32,
location: 'Utah',
specialty: 'HTML & CSS',
});

const dennis = new Student({
name: 'Dennis',
age: 29,
location: 'Wisconsin',
grade: 0,
previousBackground: 'Health IT',
className: 'web21',
favSubjects: ['Javascript', 'HTML', 'CSS', 'Back-end Dev']
});

const jackie = new ProjectManager({
name: 'Jackie',
age: 29,
location: `NYC`,
gradClassName: 'CS1',
favInstructor: 'Sean'
})


console.log(dan.speak());
console.log(dan.demo('HTML & CSS'));
console.log(dan.grade(dennis.name, 'HTML & CSS'));
dennis.listSubjects();
console.log(dennis.PRassignment('Javascript'));
console.log(dennis.sprintChallenge('Back end dev'));
console.log(jackie.standup('#web_21'));
console.log(jackie.debugsCode(dennis.name, 'Javascript'));
console.log(dennis.gradeRandom(dennis.name, dennis.grade, "Javascript"));
console.log(dennis.graduate());
Loading