Skip to content

Commit 54ce208

Browse files
stretch goal 1 completed
1 parent 9aa658b commit 54ce208

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

assignments/lambda-classes.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ class Instructor extends People{
2424
grade(student, subject){
2525
return `${student.name}, recieves a perfect score on ${subject}`;
2626
}
27+
changeGrade(student) {
28+
let random = Math.random();
29+
if (student.grade < 100){
30+
if(random > .4 ){
31+
student.grade = student.grade + (random * 10);
32+
return `${student.name}'s grade improved to ${student.grade}. ${this.name} is pleased`;
33+
}
34+
student.grade = student.grade - (random * 10);
35+
return `${student.name}'s grade dropped to ${student.grade}. ${this.name} will gladly help them improve`;
36+
}
37+
}
2738
}
2839

2940
class Student extends People{
@@ -32,6 +43,7 @@ class Student extends People{
3243
this.previousBackground = studentAttributes.previousBackground;
3344
this.className = studentAttributes.className;
3445
this.favSubjects = studentAttributes.favSubjects;
46+
this.grade = studentAttributes.grade;
3547
}
3648
listsSubjects(subjectarray){
3749
subjectarray.forEach(function (item){
@@ -90,6 +102,7 @@ const Dan = new Instructor({
90102
previousBackground: "none",
91103
className: "CPT3",
92104
favSubjects: ['Html', 'CSS', 'JavaScript', 'back-end stuff'],
105+
grade: 90,
93106
});
94107

95108
//Instructor Methods
@@ -106,4 +119,8 @@ const Dan = new Instructor({
106119
console.log(Bobby.speak());
107120
Bobby.listsSubjects(Bobby.favSubjects);
108121
console.log(Bobby.PRAssignment("Python"));
109-
console.log(Bobby.sprintChallenge("Elm"));
122+
console.log(Bobby.sprintChallenge("Elm \n"));
123+
124+
//Stretch Goals
125+
console.log(Dan.changeGrade(Bobby));
126+
console.log(John.changeGrade(Bobby));

0 commit comments

Comments
 (0)