Skip to content

Commit 7fc2a61

Browse files
committed
so i have part of the stretch completed
it only goes through once so i am going to try to get it to continue until the student graduates
1 parent ceff998 commit 7fc2a61

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

assignments/lambda-classes.js

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,36 @@ class Instructor extends Person {
2323
grade (student, subject) {
2424
return `${student.name} recieves a perfect score on ${subject}`;
2525
}
26+
graduate (student) {
27+
if (this.grade > 70) {
28+
console.log('Congratulations you have graduated')
29+
} else {
30+
console.log(`${student.name} because your score is only at ${student.grade} you are still not ready to graduate..... ${student.name} pleads with his instructor please let me have another chance to improve`)
31+
this.gradingCurve(student);
32+
}
33+
}
2634
gradingCurve(student){
27-
student.grade += Math.floor(Math.random() * 5);
35+
let stringOut = (`${student.name} let me review your latest work`)
36+
let randomGrade = Math.floor(Math.random() * 5);
37+
student.grade += randomGrade;
38+
let stringOut2 = `Well ${student.name} you have completed this assignment and your score is now a ${student.grade}. That is an improvement of ${randomGrade} points`;
39+
let arrayJoined = [stringOut, stringOut2];
40+
if (student.grade >= 70) {
41+
console.log(stringOUt);
42+
student.grade(student);
43+
} else {
44+
console.log(arrayJoined.join(" , ........."));
45+
this.grade(student);
2846
}
2947
}
30-
48+
}
3149
class Student extends Person {
3250
constructor(cprops){
3351
super(cprops);
3452
this.previousBackground = cprops.previousBackground;
3553
this.className = cprops.className;
3654
this.favSubjects = cprops.favSubjects;
37-
this.grade = cprops.grade;
55+
this.grade = cprops.grade;
3856
}
3957
listSubjects () {
4058
return this.favSubjects.join(', ');
@@ -45,11 +63,7 @@ class Student extends Person {
4563
sprintChallenge (subject) {
4664
return `${this.name} has begun spring challege on ${subject}`;
4765
}
48-
graduate () {
49-
if (this.grade > 70) {
50-
'Congratulations you have graduated'
51-
}
52-
}
66+
5367
}
5468
class ProjectManager extends Instructor {
5569
constructor(gcprops){
@@ -140,7 +154,7 @@ const nathan = new ProjectManager ({
140154
favLanguage: "JavaScript"
141155
})
142156

143-
157+
josh.graduate(holloway);
144158

145159
// Person Classes
146160
// console.log(jack.name);

0 commit comments

Comments
 (0)