feat(curriculum): adding 1st review project for JS cert (#54489)

Co-authored-by: Naomi <nhcarrigan@gmail.com>
This commit is contained in:
Jessica Wilkins
2024-04-25 14:04:51 -07:00
committed by GitHub
parent 0bda3a2f25
commit cf2485f3d4
28 changed files with 481 additions and 21 deletions

View File

@@ -465,6 +465,13 @@
"JavaScript is a powerful scripting language that you can use to make web pages interactive. It's one of the core technologies of the web, along with HTML and CSS. All modern browsers support JavaScript.",
"In this practice project, you'll learn fundamental programming concepts in JavaScript by coding your own Pyramid Generator. You'll learn how to work with arrays, strings, functions, loops, <code>if/else</code> statements, and more."
]
},
"review-js-fundamentals-by-building-a-gradebook-app": {
"title": "Review JavaScript Fundamentals by Building a Gradebook App",
"intro": [
"In this mini project, you will get to review JavaScript fundamentals like functions, variables, conditionals and more by building a gradebook app.",
"This will give you an opportunity to solve small problems and get a better understanding of the basics."
]
}
}
},

View File

@@ -0,0 +1,10 @@
---
title: Introduction to the Review JavaScript Fundamentals by Building a Gradebook App
block: review-js-fundamentals-by-building-a-gradebook-app
superBlock: javascript-algorithms-and-data-structures-v8
isBeta: true
---
## Introduction to the Review JavaScript Fundamentals by Building a Gradebook App
This is a test for the new project-based curriculum.

View File

@@ -4,7 +4,7 @@
"dashedName": "build-a-cash-register-project",
"usesMultifileEditor": true,
"helpCategory": "JavaScript",
"order": 18,
"order": 19,
"time": "30 hours",
"template": "",
"required": [],

View File

@@ -4,7 +4,7 @@
"dashedName": "build-a-palindrome-checker-project",
"usesMultifileEditor": true,
"helpCategory": "JavaScript",
"order": 5,
"order": 6,
"time": "30 hours",
"template": "",
"required": [],

View File

@@ -4,7 +4,7 @@
"dashedName": "build-a-pokemon-search-app-project",
"usesMultifileEditor": true,
"helpCategory": "JavaScript",
"order": 21,
"order": 22,
"time": "30 hours",
"template": "",
"required": [],

View File

@@ -4,7 +4,7 @@
"dashedName": "build-a-roman-numeral-converter-project",
"usesMultifileEditor": true,
"helpCategory": "JavaScript",
"order": 9,
"order": 10,
"time": "30 hours",
"template": "",
"required": [],

View File

@@ -4,7 +4,7 @@
"dashedName": "build-a-telephone-number-validator-project",
"usesMultifileEditor": true,
"helpCategory": "JavaScript",
"order": 14,
"order": 15,
"time": "30 hours",
"template": "",
"required": [],

View File

@@ -5,7 +5,7 @@
"hasEditableBoundaries": true,
"dashedName": "learn-advanced-array-methods-by-building-a-statistics-calculator",
"helpCategory": "JavaScript",
"order": 12,
"order": 13,
"time": "5 hours",
"template": "",
"required": [],

View File

@@ -5,7 +5,7 @@
"hasEditableBoundaries": true,
"dashedName": "learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard",
"helpCategory": "JavaScript",
"order": 20,
"order": 21,
"time": "5 hours",
"template": "",
"required": [],

View File

@@ -5,7 +5,7 @@
"hasEditableBoundaries": true,
"dashedName": "learn-basic-algorithmic-thinking-by-building-a-number-sorter",
"helpCategory": "JavaScript",
"order": 11,
"order": 12,
"time": "5 hours",
"template": "",
"required": [],

View File

@@ -5,7 +5,7 @@
"hasEditableBoundaries": true,
"dashedName": "learn-basic-javascript-by-building-a-role-playing-game",
"helpCategory": "JavaScript",
"order": 1,
"order": 2,
"time": "2 hours",
"template": "",
"required": [],

View File

@@ -5,7 +5,7 @@
"hasEditableBoundaries": true,
"dashedName": "learn-basic-oop-by-building-a-shopping-cart",
"helpCategory": "JavaScript",
"order": 15,
"order": 16,
"time": "5 hours",
"template": "",
"required": [],

View File

@@ -4,7 +4,7 @@
"usesMultifileEditor": true,
"hasEditableBoundaries": true,
"dashedName": "learn-basic-string-and-array-methods-by-building-a-music-player",
"order": 3,
"order": 4,
"time": "5 hours",
"template": "",
"required": [],

View File

@@ -5,7 +5,7 @@
"hasEditableBoundaries": true,
"dashedName": "learn-fetch-and-promises-by-building-an-fcc-authors-page",
"helpCategory": "JavaScript",
"order": 19,
"order": 20,
"time": "5 hours",
"template": "",
"required": [],

View File

@@ -5,7 +5,7 @@
"hasEditableBoundaries": true,
"dashedName": "learn-form-validation-by-building-a-calorie-counter",
"helpCategory": "JavaScript",
"order": 2,
"order": 3,
"time": "2 hours",
"template": "",
"required": [],

View File

@@ -5,7 +5,7 @@
"hasEditableBoundaries": true,
"dashedName": "learn-functional-programming-by-building-a-spreadsheet",
"helpCategory": "JavaScript",
"order": 13,
"order": 14,
"time": "2 hours",
"template": "",
"required": [],

View File

@@ -4,7 +4,7 @@
"usesMultifileEditor": true,
"hasEditableBoundaries": true,
"dashedName": "learn-intermediate-algorithmic-thinking-by-building-a-dice-game",
"order": 17,
"order": 18,
"time": "5 hours",
"template": "",
"required": [],

View File

@@ -5,7 +5,7 @@
"hasEditableBoundaries": true,
"dashedName": "learn-intermediate-oop-by-building-a-platformer-game",
"helpCategory": "JavaScript",
"order": 16,
"order": 17,
"time": "5 hours",
"template": "",
"required": [],

View File

@@ -4,7 +4,7 @@
"usesMultifileEditor": true,
"hasEditableBoundaries": true,
"dashedName": "learn-localstorage-by-building-a-todo-app",
"order": 7,
"order": 8,
"time": "5 hours",
"template": "",
"required": [],

View File

@@ -5,7 +5,7 @@
"hasEditableBoundaries": true,
"dashedName": "learn-modern-javascript-methods-by-building-football-team-cards",
"helpCategory": "JavaScript",
"order": 6,
"order": 7,
"time": "5 hours",
"template": "",
"required": [],

View File

@@ -5,7 +5,7 @@
"hasEditableBoundaries": true,
"dashedName": "learn-recursion-by-building-a-decimal-to-binary-converter",
"helpCategory": "JavaScript",
"order": 8,
"order": 9,
"superOrder": 6,
"time": "5 hours",
"template": "",

View File

@@ -5,7 +5,7 @@
"hasEditableBoundaries": true,
"dashedName": "learn-regular-expressions-by-building-a-spam-filter",
"helpCategory": "JavaScript",
"order": 10,
"order": 11,
"time": "5 hours",
"template": "",
"required": [],

View File

@@ -4,7 +4,7 @@
"usesMultifileEditor": true,
"hasEditableBoundaries": true,
"dashedName": "learn-the-date-object-by-building-a-date-formatter",
"order": 4,
"order": 5,
"time": "5 hours",
"template": "",
"required": [],

View File

@@ -0,0 +1,33 @@
{
"name": "Review JavaScript Fundamentals by Building a Gradebook App",
"isUpcomingChange": false,
"usesMultifileEditor": true,
"hasEditableBoundaries": true,
"dashedName": "review-js-fundamentals-by-building-a-gradebook-app",
"order": 1,
"time": "5 hours",
"template": "",
"required": [],
"superBlock": "javascript-algorithms-and-data-structures-v8",
"superOrder": 4,
"isBeta": true,
"challengeOrder": [
{
"id": "662693f82c91a66be46c881b",
"title": "Step 1"
},
{
"id": "6626a060c4006f793e10cb33",
"title": "Step 2"
},
{
"id": "6626b4c58c027d86478ff5eb",
"title": "Step 3"
},
{
"id": "6626b8dcf5057f896f948440",
"title": "Step 4"
}
],
"helpCategory": "JavaScript"
}

View File

@@ -0,0 +1,74 @@
---
id: 662693f82c91a66be46c881b
title: Step 1
challengeType: 1
dashedName: step-1
---
# --description--
A teacher has finished grading their students' tests and needs your help to calculate the average score for the class.
Complete the `getAverage` function which takes in an array of test scores and returns the average score.
The average is calculated by adding up all the scores and dividing by the total number of scores.
```js
average = sum of all scores / total number of scores
```
A couple of function calls have been provided for you so you can test out your code.
**Tips**
- You can use a loop to iterate over the `scores` array and add up all the scores.
- You can use the `length` property to get the total number of scores.
# --hints--
Your `getAverage` function should return a number.
```js
assert.strictEqual(typeof getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 'number');
```
`getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])` should return `71.7`.
```js
assert.strictEqual(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 71.7);
```
`getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])` should return `85.4`.
```js
assert.strictEqual(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]), 85.4);
```
`getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100])` should return `92.4`.
```js
assert.strictEqual(getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100]), 92.4);
```
Your `getAverage` function should return the average score of the test scores.
```js
assert.strictEqual(getAverage([52, 56, 60, 65, 70, 75, 80, 85, 90, 95]), 72.8);
assert.strictEqual(getAverage([45, 50, 55, 60, 65, 70, 75, 80, 85, 90]), 67.5);
assert.strictEqual(getAverage([38, 42, 46, 50, 54, 58, 62, 66, 70, 74]), 56);
```
# --seed--
## --seed-contents--
```js
--fcc-editable-region--
function getAverage(scores) {
}
console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]));
console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]));
--fcc-editable-region--
```

View File

@@ -0,0 +1,104 @@
---
id: 6626a060c4006f793e10cb33
title: Step 2
challengeType: 1
dashedName: step-2
---
# --description--
Now the teacher needs your help converting the student score to a letter grade.
Complete the `getGrade` function that takes a number `score` as a parameter. Your function should return a string representing a letter grade based on the score.
Here are the scores and their corresponding letter grades:
| Score Range | Grade |
| ----------- | ------- |
| `100` | `"A++"` |
| `90 - 99` | `"A"` |
| `80 - 89` | `"B"` |
| `70 - 79` | `"C"` |
| `60 - 69` | `"D"` |
| `0 - 59` | `"F"` |
**Tips**
- Remember that you learned about conditional statements(`if`, `else if`, and `else`).
- Remember that you learned about comparison operators (`>`, `<`, `>=`, `<=`, `===`).
# --hints--
Your `getGrade` function should return `"A++"` if the score is `100`.
```js
assert.strictEqual(getGrade(100), "A++");
```
Your `getGrade` function should return `"A"` if the score is `94`.
```js
assert.strictEqual(getGrade(94), "A");
```
Your `getGrade` function should return `"B"` if the score is between `80` and `89`.
```js
assert.strictEqual(getGrade(80), "B");
assert.strictEqual(getGrade(83), "B");
assert.strictEqual(getGrade(88), "B");
```
Your `getGrade` function should return `"C"` if the score is `78`.
```js
assert.strictEqual(getGrade(75), "C");
```
Your `getGrade` function should return `"D"` if the score is between `60` and `69`.
```js
assert.strictEqual(getGrade(60), "D");
assert.strictEqual(getGrade(63), "D");
assert.strictEqual(getGrade(68), "D");
```
Your `getGrade` function should return `"F"` if the score is `57`.
```js
assert.strictEqual(getGrade(57), "F");
```
Your `getGrade` function should return `"F"` if the score is between `0` and `59`.
```js
assert.strictEqual(getGrade(0), "F");
assert.strictEqual(getGrade(30), "F");
assert.strictEqual(getGrade(43), "F");
```
# --seed--
## --seed-contents--
```js
function getAverage(scores) {
let sum = 0;
for (const score of scores) {
sum += score;
}
return sum / scores.length;
}
--fcc-editable-region--
function getGrade(score) {
}
console.log(getGrade(96));
console.log(getGrade(82));
console.log(getGrade(56));
--fcc-editable-region--
```

View File

@@ -0,0 +1,88 @@
---
id: 6626b4c58c027d86478ff5eb
title: Step 3
challengeType: 1
dashedName: step-3
---
# --description--
The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an `"F"`.
Complete the function `hasPassingGrade` that takes a student score as a parameter. Your function should return `true` if the student has a passing grade and `false` if they do not.
**Tips**
- Use the `getGrade` function to get the student's grade. Then check if the grade is passing or not.
# --hints--
Your `hasPassingGrade` function should return a boolean value.
```js
assert.strictEqual(typeof hasPassingGrade(100), "boolean");
```
Your `hasPassingGrade` function should return `true` if the grade is an `"A"`.
```js
assert.isTrue(hasPassingGrade(100));
```
Your `hasPassingGrade` function should return `false` if the grade is an `"F"`.
```js
assert.isFalse(hasPassingGrade(53));
```
Your `hasPassingGrade` function should return `true` for all passing grades.
```js
assert.isTrue(hasPassingGrade(87));
assert.isTrue(hasPassingGrade(60));
assert.isTrue(hasPassingGrade(73));
assert.isTrue(hasPassingGrade(96));
```
# --seed--
## --seed-contents--
```js
function getAverage(scores) {
let sum = 0;
for (const score of scores) {
sum += score;
}
return sum / scores.length;
}
function getGrade(score) {
if (score === 100) {
return "A++";
} else if (score >= 90) {
return "A";
} else if (score >= 80) {
return "B";
} else if (score >= 70) {
return "C";
} else if (score >= 60) {
return "D";
} else {
return "F";
}
}
--fcc-editable-region--
function hasPassingGrade(score) {
}
console.log(hasPassingGrade(100));
console.log(hasPassingGrade(53));
console.log(hasPassingGrade(87));
--fcc-editable-region--
```

View File

@@ -0,0 +1,144 @@
---
id: 6626b8dcf5057f896f948440
title: Step 4
challengeType: 1
dashedName: step-4
---
# --description--
Now that the teacher has all of the information they need, they want to be able to message the student with the results.
Complete the `studentMsg` function with `totalScores` and `studentScore` for parameters. The function should return a string representing a message to the student.
If the student passed the course, the string should follow this format:
```js
Class average: average-goes-here. Your grade: grade-goes-here. You passed the course.
```
If the student failed the course, the string should follow this format:
```js
Class average: average-goes-here. Your grade: grade-goes-here. You failed the course.
```
Replace `average-goes-here` with the average of the total scores.
Replace `grade-goes-here` with the student's grade.
**Tips**
- Use the `getAverage` function to get the class average.
- Use the `getGrade` function to get the student's grade.
- Use string concatenation (`+`) to build the message.
- Be careful with the punctuation and spaces in the message.
# --hints--
Your function call of `studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)` should return the following message: `"Class average: 71.7. Your grade: F. You failed the course."`.
```js
assert.strictEqual(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37), "Class average: 71.7. Your grade: F. You failed the course.");
```
Your function call of `studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)` should return the following message: `"Class average: 50.8. Your grade: A++. You passed the course."`.
```js
assert.strictEqual(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100), "Class average: 50.8. Your grade: A++. You passed the course.");
```
Your `studentMsg` function should return a the correct message based on the student's score and the class average.
```js
assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 92), "Class average: 70.25. Your grade: A. You passed the course.");
assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 57), "Class average: 70.25. Your grade: F. You failed the course.");
```
# --seed--
## --seed-contents--
```js
function getAverage(scores) {
let sum = 0;
for (const score of scores) {
sum += score;
}
return sum / scores.length;
}
function getGrade(score) {
if (score === 100) {
return "A++";
} else if (score >= 90) {
return "A";
} else if (score >= 80) {
return "B";
} else if (score >= 70) {
return "C";
} else if (score >= 60) {
return "D";
} else {
return "F";
}
}
function hasPassingGrade(score) {
return getGrade(score) !== "F";
}
--fcc-editable-region--
function studentMsg(totalScores, studentScore) {
}
console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));
--fcc-editable-region--
```
# --solutions--
```js
function getAverage(scores) {
let sum = 0;
for (const score of scores) {
sum += score;
}
return sum / scores.length;
}
function getGrade(score) {
if (score === 100) {
return "A++";
} else if (score >= 90) {
return "A";
} else if (score >= 80) {
return "B";
} else if (score >= 70) {
return "C";
} else if (score >= 60) {
return "D";
} else {
return "F";
}
}
function hasPassingGrade(score) {
return getGrade(score) !== "F";
}
function studentMsg(totalScores, studentScore) {
let average = getAverage(totalScores);
let grade = getGrade(studentScore);
return `Class average: ${average}. Your grade: ${grade}. You ${
hasPassingGrade(studentScore) ? "passed" : "failed"
} the course.`;
}
```