Skip to content

Commit e0711de

Browse files
committed
finished studio
1 parent 184677f commit e0711de

File tree

5 files changed

+3743
-4
lines changed

5 files changed

+3743
-4
lines changed

classes/studio/ClassStudio.js

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,81 @@
11
//Declare a class called CrewCandidate with a constructor that takes three parameters—name, mass, and scores. Note that scores will be an array of test results.
2+
class CrewCandidate{
3+
constructor(name, mass, scores){
4+
this.name = name;
5+
this.mass = mass;
6+
this.scores = scores;
7+
}
8+
addScore(newScore){
9+
this.scores.push(newScore);
10+
return this.scores;
211

12+
}
13+
average(){
14+
let totalScore = 0;
15+
for (let i = 0; i < this.scores.length; i++){
16+
totalScore += this.scores[i];
17+
18+
}
19+
20+
let average = Math.round((totalScore / this.scores.length) * 10) / 10 ;
321

22+
return average;
423

5-
//Add methods for adding scores, averaging scores and determining candidate status as described in the studio activity.
24+
}
25+
status(){
26+
if(this.average() > 90){
27+
return "Accepted";
28+
29+
}
30+
else if(this.average() < 89 || this.average() > 80){
31+
return "Reserve";
32+
33+
}
34+
else if (this.average() > 70 || this.average() < 79){
35+
return "probationary";
36+
37+
}
38+
else if (this.average() < 70){
39+
return "Rejected";
40+
41+
}
42+
}
43+
}
44+
45+
let candidateA = new CrewCandidate("Bubba Bear",135 , [88,85,90]);
46+
let candidateB = new CrewCandidate("Merry Maltese", 1.5, [93,88,97]);
47+
let candidateC = new CrewCandidate("Glad Gator",225,[75,78,62]);
48+
49+
50+
let j = 0;
51+
do {
52+
53+
let updatedScore = Math.round(Math.random()* 100);
54+
if (updatedScore > 90){
55+
56+
candidateC.addScore(updatedScore);
57+
j++;
58+
}
59+
} while (candidateC.status() != "Reserve")
60+
console.log(candidateC.status() + candidateC.scores);
61+
console.log(j);
662

763

864

9-
//Part 4 - Use the methods to boost Glad Gator’s status to Reserve or higher. How many tests will it take to reach Reserve status? How many to reach Accepted? Remember, scores cannot exceed 100%.
65+
66+
67+
68+
69+
70+
candidateA.addScore(83);
71+
console.log ( `${candidateA.name} 'earned an average test score of ${candidateA.average()}% and has a status of ${candidateA.status()}.'`);
72+
console.log ( `${candidateB.name} 'earned an average test score of ${candidateB.average()}% and has a status of ${candidateB.status()}.'`);
73+
console.log ( `${candidateC.name} 'earned an average test score of ${candidateC.average()}% and has a status of ${candidateC.status()}.'`)
74+
// console.log(candidateA.scores)
75+
// console.log(candidateA,
76+
// candidateB,
77+
// candidateC)
78+
79+
//Add methods for adding scores, averaging scores and determining candidate status as described in the studio activity.
80+
81+
//Part 4 - Use the methods to boost Glad Gator’s status to Reserve or higher. How many tests will it take to reach Reserve status? How many to reach Accepted? Remember, scores cannot exceed 100%.**

classes/studio/package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unit-testing/studio/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11

22
let launchcode = {
3+
orginzation : "nonprofit",
4+
executiveDirector : "Jeff",
5+
percentageCoolEmployees : 100,
6+
programsOffered : ["Web Development", "Data Analysis", "Liftoff"]
7+
38

49
}
510

0 commit comments

Comments
 (0)