diff --git a/index.js b/index.js index fc39606fe..bcdce8a1b 100644 --- a/index.js +++ b/index.js @@ -44,7 +44,23 @@ class Airplane { */ class Person { - + + constructor(name, age){ + this.name = name; + this.age = age; + this.stomach = []; + } + eat(edible){ + if(this.stomach.length < 10){ + this.stomach.push(edible) + } + } + poop(){ + this.stomach = []; + } + toString(){ + return `${this.name} and ${this.age}` + } } /* @@ -62,7 +78,27 @@ 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){ + if(distance >= this.tank * this.milesPerGallon){ + this.odometer = this.odometer + this.tank * this.milesPerGallon; + this.tank = 0; + return `I ran out of fuel at ${this.odometer} miles!`; + } + else{ + this.odometer = this.odometer + distance; + this.tank = ((this.tank * this.milesPerGallon) - distance) / this.milesPerGallon; + } + + } } /* @@ -79,7 +115,15 @@ class Car { */ class Lambdasian { - + + constructor(attributes){ + this.name = attributes.name; + this.age = attributes.age; + this.location = attributes.location; + } + speak(){ + return `Hello my name is ${this.name}, I am from ${this.location}` + } } /* @@ -97,8 +141,19 @@ 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(attributes){ + super(attributes); + this.specialty = attributes.specialty; + this.favLanguage = attributes.favLanguage; + this.catchPhrase = attributes.catchPhrase; + } + demo(subject){ + return `Today we are learning about ${subject}`; + } + grade(student,subject){ + return `${student.name} receives a perfect score on ${subject}`; + } } /* @@ -117,8 +172,22 @@ class Instructor { + `sprintChallenge` similar to PRAssignment but returns `student.name has begun sprint challenge on {subject}` */ -class Student { - +class Student extends Lambdasian { + constructor(attributes){ + super(attributes); + this.previousBackground = attributes.previousBackground; + this.className = attributes.className; + this.favSubjects = attributes.favSubjects; + } + listSubjects(){ + return `Loving ${this.favSubjects}, ${this.favSubjects}, ${this.favSubjects}!` + } + PRAssignment(subject){ + return `${this.name} has submitted a PR for ${subject}` + } + sprintChallenge(subject){ + return `${this.name} has begun sprint challenge on ${subject}` + } } /* @@ -135,8 +204,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(attributes){ + super(attributes); + this.gradClassName = attributes.gradClassName; + this.favInstructor = attributes.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}` + } } /* diff --git a/package-lock.json b/package-lock.json index 3e3866147..4a96a12c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "codegraded-project-js", - "version": "0.0.7", + "version": "0.0.9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "codegraded-project-js", - "version": "0.0.7", + "version": "0.0.9", "devDependencies": { "@babel/core": "7.17.8", "@babel/plugin-transform-runtime": "7.17.0",