forked from bloominstituteoftechnology/JavaScript-IV
-
Notifications
You must be signed in to change notification settings - Fork 0
JavaScript-IV #1
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
ThorbenBender
wants to merge
5
commits into
master
Choose a base branch
from
Thorben-Bender
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,154 @@ | ||
| // CODE here for your Lambda Classes | ||
| class Person{ | ||
| constructor(attributes){ | ||
| this.name = attributes.name; | ||
| this.age = attributes.age; | ||
| this.location = attributes.location; | ||
| this.gender = attributes.gender; | ||
| } | ||
| speak() { | ||
| console.log(`Hello my name is ${this.name}, I am from ${this.location}`); | ||
| } | ||
| } | ||
|
|
||
| class Instructor extends Person { | ||
| constructor(attributes){ | ||
| super(attributes) | ||
| this.specialty = attributes.specialty; | ||
| this.favLanguage = attributes.favLanguage; | ||
| this.catchPhrase = attributes.catchPhrase; | ||
| } | ||
| demo(subject) { | ||
| console.log(`Today we are learning about ${subject}`); | ||
| } | ||
| grade(student, subject) { | ||
| let randNum = Math.floor(Math.random()*3); | ||
| if(randNum === 0){ | ||
| let points = Math.floor(Math.random()*11); | ||
| student.score -= points; | ||
| console.log(`You have to work on ${subject}. I have to remove ${points} points from your score. You have only ${student.score} left.`) | ||
| } else if (randNum === 1 || randNum === 2) { | ||
| let points = Math.floor(Math.random()*11); | ||
| student.score += points; | ||
| console.log(`Great work on ${subject}. I add ${points} points to your score. You have now ${student.score} points.`); | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
| class Student extends Person { | ||
| constructor(attributes){ | ||
| super(attributes); | ||
| this.score = Math.floor(Math.random()*100); | ||
| this.previousBackground = attributes.previousBackground; | ||
| this.className = attributes.className; | ||
| this.favSubjects = attributes.favSubjects; | ||
| } | ||
| listsSubjects(){ | ||
| for (let i = 0; i < this.favSubjects.length; i++){ | ||
| console.log(this.favSubjects[i]); | ||
| } | ||
| } | ||
| PRAssignment(subject){ | ||
| console.log(`${this.name} has submitted a PR for ${subject}.`); | ||
| } | ||
| sprintChallenge(subject){ | ||
| console.log(`${this.name} has begun sprint challenge on ${subject}.`); | ||
| } | ||
| graduate(){ | ||
| if(this.score >= 70){ | ||
| console.log(`Good job, ${this.name}. You perfected the art of clicking your keyboard wile sitting in a dark room. Here is your black hoodie!`) | ||
| } else { | ||
| console.log(`Sorry ${this.name}. You are not ready. Go back in your dark room and try to type faster.`) | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
| class ProjectManager extends Instructor { | ||
| constructor(attributes){ | ||
| super(attributes); | ||
| this.gradClassName = attributes.gradClassName; | ||
| this.favInstructor = attributes.favInstructor; | ||
| } | ||
| standUp(channel){ | ||
| console.log(`${this.name} announces to ${channel}, @channel standy time!`); | ||
| } | ||
| debugsCode(student, subject){ | ||
| console.log(`${this.name} debugs ${student.name}'s code on ${subject}.`) | ||
| } | ||
| } | ||
|
|
||
| const Mark = new Instructor({ | ||
| name: 'Mark', | ||
| age: 20, | ||
| location: 'Paris', | ||
| gender: 'Male', | ||
| specialty: 'React', | ||
| favLanguage: 'Python', | ||
| catchPhrase: 'If you want more ram, just download it.' | ||
| }); | ||
|
|
||
| const Sean = new Instructor({ | ||
| name: 'Sean', | ||
| age: 26, | ||
| location: 'Tokyo', | ||
| gender: 'Male', | ||
| specialty: '', | ||
| favLanguage: 'C++', | ||
| catchPhrase: 'Did you try to restart your pc?' | ||
| }); | ||
|
|
||
| const John = new Instructor({ | ||
| name: 'John', | ||
| age: 32, | ||
| location: 'Seoul', | ||
| gender: 'Female', | ||
| specialty: 'Redux', | ||
| favLanguage: 'JavaScript', | ||
| catchPhrase: 'If you want more ram, just download it.' | ||
| }); | ||
|
|
||
| const Tim = new Student({ | ||
| name: 'Tim', | ||
| age: 26, | ||
| location: 'Berlin', | ||
| gender: 'Male', | ||
| previousBackground: 'owned a own company', | ||
| className: 'WEBEU1', | ||
| favSubjects: ['Less', 'React', 'Redux'] | ||
| }); | ||
|
|
||
| const Max = new Student({ | ||
| name: 'Max', | ||
| age: 32, | ||
| location: 'Dublin', | ||
| gender: 'Female', | ||
| previousBackground: 'Studied economics', | ||
| className: 'WEBEU1', | ||
| favSubjects: ['CSS', 'HTML5', 'React'] | ||
| }); | ||
|
|
||
| const Samar = new ProjectManager({ | ||
| name: 'Samar', | ||
| age: 32, | ||
| location: 'Dheli', | ||
| gender: 'Male', | ||
| specialty: 'React', | ||
| favLanguage: 'JavaScript', | ||
| catchPhrase: 'If you have windows, you\'re doomed', | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. amen! |
||
| gradClassName: 'WEBEU1', | ||
| favInstructor: 'Gabriel' | ||
| }); | ||
|
|
||
| const Oliver = new ProjectManager({ | ||
| name: 'Oliver', | ||
| age: 32, | ||
| location: 'London', | ||
| gender: 'Male', | ||
| specialty: 'Python', | ||
| favLanguage: 'C++', | ||
| catchPhrase: 'If you have apple, you\'re doomed', | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not true. |
||
| gradClassName: 'WEBEU1', | ||
| favInstructor: 'Tom' | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try and keep your code DRY. You are using -
Math.floor(Math.random() );in 3 different places inside one function. maybe you can create a function?