You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//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.
//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%.
console.log(`${bubbaBear.name} earned an average test score of ${bubbaBear.calculateAverageScore()}% and has a status of ${bubbaBearStatus}.`);
56
+
console.log(`${merryMaltese.name} earned an average test score of ${merryMaltese.calculateAverageScore()}% and has a status of ${merryMalteseStatus}.`);
57
+
console.log(`${gladGator.name} earned an average test score of ${gladGator.calculateAverageScore()}% and has a status of ${gladGatorStatus}.`);
58
+
59
+
// Reset Glad Gator's scores for the test
60
+
gladGator.scores=[75,78,62];
61
+
62
+
// Define the target status
63
+
consttargetStatus="Accepted";
64
+
65
+
lettestsTaken=0;
66
+
67
+
while(gladGator.status()!==targetStatus){
68
+
// Increment the test score by 5 (or any other increment you prefer)
69
+
constnewScore=gladGator.scores[testsTaken%3]+5;
70
+
71
+
// Ensure the score doesn't exceed 100
72
+
if(newScore<=100){
73
+
gladGator.scores[testsTaken%3]=newScore;
74
+
testsTaken++;
75
+
}else{
76
+
break;// Break the loop if the score cannot be increased further
77
+
}
78
+
}
79
+
80
+
console.log(`Glad Gator reached ${targetStatus} status after taking ${testsTaken} tests.`);
0 commit comments