Skip to content

Answered all the question including the STRETCH problem #274

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

Open
wants to merge 1 commit into
base: main
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
107 changes: 99 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,23 @@ class Airplane {
*/

class Person {

constructor(name, age){
this.stomach = [];
this.name = name;
this.age = age;
}
eat(someFood) {
if(this.stomach.length < 10)
{
this.stomach.push(someFood);
}
}
poop() {
this.stomach = [];
}
toString(){
return `${this.name}, ${this.age}`;
}
}

/*
Expand All @@ -62,7 +78,26 @@ class Person {
*/

class Car {

constructor(model, milesPerGallon) {
this.model = model;
this.milesPerGallon = milesPerGallon;
this.tank = 0;
this.odometer = 0;
}
fill(gallons){
this.tank += gallons;
}
drive(distance){
let maxDistance = this.tank * this.milesPerGallon;
if (maxDistance > distance){
this.odometer += distance;
this.tank = this.tank - (distance / this.milesPerGallon).toFixed(2);
} else {
this.odometer += maxDistance;
this.tank = 0;
return `I ran out of fuel at ${this.odometer} miles!`;
}
}
}

/*
Expand All @@ -79,7 +114,14 @@ class Car {
*/

class Lambdasian {

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

/*
Expand All @@ -97,7 +139,23 @@ class Lambdasian {
+ `grade` receives a `student` object and a `subject` string as arguments and returns '{student.name} receives a perfect score on {subject}'
*/

class Instructor {
class Instructor extends Lambdasian{
constructor(arg){
super(arg);
this.specialty = arg.specialty;
this.favLanguage = arg.favLanguage;
this.catchPhrase = arg.catchPhrase;
}
demo(subject){
return `Today we are learning about ${subject}`
}
grade(student, subject){
return `${student.name} receives a perfect score on ${subject}`;
}
randomGrade(grade){
let randomNumber = Math.floor(Math.random() * (10 - (-10)) + (-10));
return grade += randomNumber;
}

}

Expand All @@ -117,8 +175,31 @@ class Instructor {
+ `sprintChallenge` similar to PRAssignment but returns `student.name has begun sprint challenge on {subject}`
*/

class Student {

class Student extends Lambdasian{
constructor(arg){
super(arg);
this.previousBackground = arg.previousBackground;
this.className = arg.className;
this.favSubjects = arg.favSubjects;
this.grade = arg.grade;
}
listSubjects(){
return `Loving ${this.favSubjects}`;
}
PRAssignment(subject){
return `${this.name} has submitted a PR for ${subject}`;
}
sprintChallenge(subject){
return `${this.name} has begun sprint challenge on ${subject}`;
}
graduate(){
if (this.grade > 70)
{
return `You are ready to graduate!`;
} else {
return `You still need to increase your grade in order to graduate!`;
}
}
}

/*
Expand All @@ -135,8 +216,18 @@ class Student {
+ `debugsCode` a method that takes in a student object and a subject and returns `{name} debugs {student.name}'s code on {subject}`
*/

class ProjectManager {

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

/*
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.