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
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ This challenge focuses on classes in JavaScript using the new `class` keyword.

**Follow these steps to set up and work on your project:**

* [ ] Create a forked copy of this project.
* [ ] Add your project manager as collaborator on Github.
* [ ] Clone your OWN version of the repository (Not Lambda's by mistake!).
* [ ] Create a new branch: git checkout -b `<firstName-lastName>`.
* [ ] Implement the project on your newly created `<firstName-lastName>` branch, committing changes regularly.
* [ ] Push commits: git push origin `<firstName-lastName>`.
* [x] Create a forked copy of this project.
* [x] Add your project manager as collaborator on Github.
* [x] Clone your OWN version of the repository (Not Lambda's by mistake!).
* [x] Create a new branch: git checkout -b `<firstName-lastName>`.
* [x] Implement the project on your newly created `<firstName-lastName>` branch, committing changes regularly.
* [x] Push commits: git push origin `<firstName-lastName>`.

**Follow these steps for completing your project.**

* [ ] Submit a Pull-Request to merge <firstName-lastName> Branch into master (student's Repo). **Please don't merge your own pull request**
* [ ] Add your project manager as a reviewer on the pull-request
* [ ] Your project manager will count the project as complete by merging the branch back into master.
* [x] Submit a Pull-Request to merge <firstName-lastName> Branch into master (student's Repo). **Please don't merge your own pull request**
* [x] Add your project manager as a reviewer on the pull-request
* [x] Your project manager will count the project as complete by merging the branch back into master.

## Assignment Description

Expand All @@ -42,12 +42,12 @@ const fred = new Person({
* **Fork** and clone this repository.
* **Complete** all of the exercises found in the assignment files.

## `prototype-refactor` - Take existing code and make it modern.
[x] ## `prototype-refactor` - Take existing code and make it modern.

* You're going to work with your prototypes assignment you built out yesterday.
* `Challenge:` **Convert** all of your constructors into ES6 Classes using the `class` and `extends` keywords. You should be able to run your same logs and they should build out the proper expected behaviors.

## `lambda-classes` - We need a roster of Lambda School personnel. Build it!
[x] ## `lambda-classes` - We need a roster of Lambda School personnel. Build it!

* We have a school to build here! This project will get you used to thinking about classes in JavaScript and building them from a brand new data set.
* Lambda personnel can be broken down into three different types of `people`.
Expand Down Expand Up @@ -110,7 +110,7 @@ const fred = new Instructor({
* `standUp` a method that takes in a slack channel and logs `{name} announces to {channel}, @channel standy times!​​​​​
* `debugsCode` a method that takes in a student object and a subject and logs out `{name} debugs {student.name}'s code on {subject}`

#### Stretch Problem
[x] #### Stretch Problem

* Extend the functionality of the Student by adding a prop called grade and setting it equal to a number between 1-100.
* Now that our students have a grade build out a method on the Instructor (this will be used by _BOTH_ instructors and PM's) that will randomly add or subtract points to a student's grade. _Math.random_ will help.
Expand Down
2 changes: 2 additions & 0 deletions assignments/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!doctype html>

<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Expand All @@ -14,4 +15,5 @@
<body>
<h1>JS IV - Check your work in the console!</h1>
</body>

</html>
173 changes: 173 additions & 0 deletions assignments/lambda-classes.js
Original file line number Diff line number Diff line change
@@ -1 +1,174 @@
// CODE here for your Lambda Classes

class Person {
constructor(attributes) {
this.name = attributes.name;
this.age = attributes.age;
this.location = attributes.location;
}
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) {
console.log(`${student.name} receives a perfect score on ${subject}.`);
}
updateGrade(student) {
let changeAmount = Math.floor((Math.random() * 100) + 1);
if (Math.floor((Math.random() * 2) + 1) === 1) {
student.grade += changeAmount;
} else {
student.grade -= changeAmount;
}
if (student.grade > 100) {
student.grade = 100;
}
if (student.grade < 0) {
student.grade = 0;
}
console.log(`${student.name}'s new grade is ${student.grade}%.`)
}
}

class Student extends Person {
constructor(attributes) {
super(attributes);
this.previousBackground = attributes.previousBackground;
this.className = attributes.className;
this.favSubjects = attributes.favSubjects;
this.grade = attributes.grade;
}
listsSubjects() {
this.favSubjects.forEach(element => { console.log(element) })
}
PRAssignment(subject) {
console.log(`${this.name} has submitted a PR for ${subject}.`)
}
sprintChallenge(student, subject) {
console.log(`${student.name} has begun sprint challenge on ${subject}.`);
}
graduate() {
if (this.grade > 70) {
console.log(`${this.name}'s grade is ${this.grade}%. ${this.name} can graduate! Sweet!`);
} else {
console.log(`${this.name}'s grade is ${this.grade}%. That's not high enough to graduate yet. Let's keep grading papers.`)
}
}
}

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 stand up time!`);
}
debugsCode(student, subject) {
console.log(`${this.name} debugs ${student.name}'s code on ${subject}.`)
}
}


/* ====== OBJECTS ====== */

const dan = new Instructor({
name: "Dan",
age: 45,
location: "Jupiter, MO",
specialty: "React",
favLanguage: "JavaScript",
catchPhrase: "Let's react to React!"
});

const jeff = new Instructor({
name: "Jeff",
age: 33,
location: "Mars, FL",
specialty: "SASS",
favLanguage: "CSS",
cathPhrase: "Let's get sassy with SASS!"
});

const dave = new Student({
name: "Dave",
age: 40,
location: "Mesa, AZ",
previousBackground: "Immigration Officer",
className: "Full Stack Web",
favSubjects: ["JavaScript", "CSS", "HTML"],
grade: 73
});

const eli = new Student({
name: "Eli",
age: 24,
location: "Provo, UT",
previousBackground: "High School",
className: "App Development",
favSubjects: ["React", "LESS", "Node.js"],
grade: 87
});

const max = new ProjectManager({
name: "Max",
age: 27,
location: "Austin, TX",
gradClassName: "Web 95",
favInstructor: jeff
})

const april = new ProjectManager({
name: "April",
age: 32,
location: "Minneapolis, MN",
gradClassName: "Mobile Dev 54",
favInstructor: dan
})


/* ====== OBJECT TESTS ====== */

console.log(dan);
dan.demo("Node.js");
dan.grade(eli, "Node.js");
dan.updateGrade(dave);
dan.updateGrade(eli);

console.log(jeff)
jeff.demo("Semantic Elements");
jeff.grade(dave, "Semantic Elements");
jeff.updateGrade(dave);
jeff.updateGrade(eli);

console.log(dave);
dave.listsSubjects(dave.favSubjects);
dave.PRAssignment("history");
dave.sprintChallenge(dave, "LESS");
dave.graduate();

console.log(eli);
eli.listsSubjects(eli.favSubjects);
eli.PRAssignment("history");
eli.sprintChallenge(eli, "Advanced HTML");
eli.graduate();

console.log(max);
max.standUp("Channel 12");
max.debugsCode(dave, "Lambda Classes");

console.log(april);
april.standUp("Disney Channel");
april.debugsCode(dave, "The Enigma Machine");
Loading