diff --git a/client/i18n/locales/english/intro.json b/client/i18n/locales/english/intro.json index 096488d2426..6dd679910ff 100644 --- a/client/i18n/locales/english/intro.json +++ b/client/i18n/locales/english/intro.json @@ -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, if/else 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." + ] } } }, diff --git a/client/src/pages/learn/javascript-algorithms-and-data-structures-v8/review-js-fundamentals-by-building-a-gradebook-app/index.md b/client/src/pages/learn/javascript-algorithms-and-data-structures-v8/review-js-fundamentals-by-building-a-gradebook-app/index.md new file mode 100644 index 00000000000..f1ea903e197 --- /dev/null +++ b/client/src/pages/learn/javascript-algorithms-and-data-structures-v8/review-js-fundamentals-by-building-a-gradebook-app/index.md @@ -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. diff --git a/curriculum/challenges/_meta/build-a-cash-register-project/meta.json b/curriculum/challenges/_meta/build-a-cash-register-project/meta.json index dadbff757ab..32bcd54ef4c 100644 --- a/curriculum/challenges/_meta/build-a-cash-register-project/meta.json +++ b/curriculum/challenges/_meta/build-a-cash-register-project/meta.json @@ -4,7 +4,7 @@ "dashedName": "build-a-cash-register-project", "usesMultifileEditor": true, "helpCategory": "JavaScript", - "order": 18, + "order": 19, "time": "30 hours", "template": "", "required": [], diff --git a/curriculum/challenges/_meta/build-a-palindrome-checker-project/meta.json b/curriculum/challenges/_meta/build-a-palindrome-checker-project/meta.json index b4a53add748..d516e9f0b07 100644 --- a/curriculum/challenges/_meta/build-a-palindrome-checker-project/meta.json +++ b/curriculum/challenges/_meta/build-a-palindrome-checker-project/meta.json @@ -4,7 +4,7 @@ "dashedName": "build-a-palindrome-checker-project", "usesMultifileEditor": true, "helpCategory": "JavaScript", - "order": 5, + "order": 6, "time": "30 hours", "template": "", "required": [], diff --git a/curriculum/challenges/_meta/build-a-pokemon-search-app-project/meta.json b/curriculum/challenges/_meta/build-a-pokemon-search-app-project/meta.json index ee22a4db890..803344f9d1a 100644 --- a/curriculum/challenges/_meta/build-a-pokemon-search-app-project/meta.json +++ b/curriculum/challenges/_meta/build-a-pokemon-search-app-project/meta.json @@ -4,7 +4,7 @@ "dashedName": "build-a-pokemon-search-app-project", "usesMultifileEditor": true, "helpCategory": "JavaScript", - "order": 21, + "order": 22, "time": "30 hours", "template": "", "required": [], diff --git a/curriculum/challenges/_meta/build-a-roman-numeral-converter-project/meta.json b/curriculum/challenges/_meta/build-a-roman-numeral-converter-project/meta.json index 5c9c12e848b..60b36c4acdf 100644 --- a/curriculum/challenges/_meta/build-a-roman-numeral-converter-project/meta.json +++ b/curriculum/challenges/_meta/build-a-roman-numeral-converter-project/meta.json @@ -4,7 +4,7 @@ "dashedName": "build-a-roman-numeral-converter-project", "usesMultifileEditor": true, "helpCategory": "JavaScript", - "order": 9, + "order": 10, "time": "30 hours", "template": "", "required": [], diff --git a/curriculum/challenges/_meta/build-a-telephone-number-validator-project/meta.json b/curriculum/challenges/_meta/build-a-telephone-number-validator-project/meta.json index ff310353aab..8316b37ef6c 100644 --- a/curriculum/challenges/_meta/build-a-telephone-number-validator-project/meta.json +++ b/curriculum/challenges/_meta/build-a-telephone-number-validator-project/meta.json @@ -4,7 +4,7 @@ "dashedName": "build-a-telephone-number-validator-project", "usesMultifileEditor": true, "helpCategory": "JavaScript", - "order": 14, + "order": 15, "time": "30 hours", "template": "", "required": [], diff --git a/curriculum/challenges/_meta/learn-advanced-array-methods-by-building-a-statistics-calculator/meta.json b/curriculum/challenges/_meta/learn-advanced-array-methods-by-building-a-statistics-calculator/meta.json index 80343b7559d..2b42142ba1d 100644 --- a/curriculum/challenges/_meta/learn-advanced-array-methods-by-building-a-statistics-calculator/meta.json +++ b/curriculum/challenges/_meta/learn-advanced-array-methods-by-building-a-statistics-calculator/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/meta.json b/curriculum/challenges/_meta/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/meta.json index 9ac3490844c..38f1c44b13f 100644 --- a/curriculum/challenges/_meta/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/meta.json +++ b/curriculum/challenges/_meta/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-basic-algorithmic-thinking-by-building-a-number-sorter/meta.json b/curriculum/challenges/_meta/learn-basic-algorithmic-thinking-by-building-a-number-sorter/meta.json index b04b277dd38..36006d47c47 100644 --- a/curriculum/challenges/_meta/learn-basic-algorithmic-thinking-by-building-a-number-sorter/meta.json +++ b/curriculum/challenges/_meta/learn-basic-algorithmic-thinking-by-building-a-number-sorter/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-basic-javascript-by-building-a-role-playing-game/meta.json b/curriculum/challenges/_meta/learn-basic-javascript-by-building-a-role-playing-game/meta.json index f398884f1d3..cbe1acc4897 100644 --- a/curriculum/challenges/_meta/learn-basic-javascript-by-building-a-role-playing-game/meta.json +++ b/curriculum/challenges/_meta/learn-basic-javascript-by-building-a-role-playing-game/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-basic-oop-by-building-a-shopping-cart/meta.json b/curriculum/challenges/_meta/learn-basic-oop-by-building-a-shopping-cart/meta.json index 783576658b1..0ccfda39c75 100644 --- a/curriculum/challenges/_meta/learn-basic-oop-by-building-a-shopping-cart/meta.json +++ b/curriculum/challenges/_meta/learn-basic-oop-by-building-a-shopping-cart/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-basic-string-and-array-methods-by-building-a-music-player/meta.json b/curriculum/challenges/_meta/learn-basic-string-and-array-methods-by-building-a-music-player/meta.json index 407e0317a19..62a3e0a42bf 100644 --- a/curriculum/challenges/_meta/learn-basic-string-and-array-methods-by-building-a-music-player/meta.json +++ b/curriculum/challenges/_meta/learn-basic-string-and-array-methods-by-building-a-music-player/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-fetch-and-promises-by-building-an-fcc-authors-page/meta.json b/curriculum/challenges/_meta/learn-fetch-and-promises-by-building-an-fcc-authors-page/meta.json index 64f34bb16d5..50befd21453 100644 --- a/curriculum/challenges/_meta/learn-fetch-and-promises-by-building-an-fcc-authors-page/meta.json +++ b/curriculum/challenges/_meta/learn-fetch-and-promises-by-building-an-fcc-authors-page/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-form-validation-by-building-a-calorie-counter/meta.json b/curriculum/challenges/_meta/learn-form-validation-by-building-a-calorie-counter/meta.json index c729392dc5a..ff5b781684c 100644 --- a/curriculum/challenges/_meta/learn-form-validation-by-building-a-calorie-counter/meta.json +++ b/curriculum/challenges/_meta/learn-form-validation-by-building-a-calorie-counter/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-functional-programming-by-building-a-spreadsheet/meta.json b/curriculum/challenges/_meta/learn-functional-programming-by-building-a-spreadsheet/meta.json index 27d34df304f..a0fc476546a 100644 --- a/curriculum/challenges/_meta/learn-functional-programming-by-building-a-spreadsheet/meta.json +++ b/curriculum/challenges/_meta/learn-functional-programming-by-building-a-spreadsheet/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/meta.json b/curriculum/challenges/_meta/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/meta.json index 593489786c6..5231daf737d 100644 --- a/curriculum/challenges/_meta/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/meta.json +++ b/curriculum/challenges/_meta/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-intermediate-oop-by-building-a-platformer-game/meta.json b/curriculum/challenges/_meta/learn-intermediate-oop-by-building-a-platformer-game/meta.json index b123c8c40f4..7998fa225ab 100644 --- a/curriculum/challenges/_meta/learn-intermediate-oop-by-building-a-platformer-game/meta.json +++ b/curriculum/challenges/_meta/learn-intermediate-oop-by-building-a-platformer-game/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-localstorage-by-building-a-todo-app/meta.json b/curriculum/challenges/_meta/learn-localstorage-by-building-a-todo-app/meta.json index 18c5596ec2f..d03441bb199 100644 --- a/curriculum/challenges/_meta/learn-localstorage-by-building-a-todo-app/meta.json +++ b/curriculum/challenges/_meta/learn-localstorage-by-building-a-todo-app/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-modern-javascript-methods-by-building-football-team-cards/meta.json b/curriculum/challenges/_meta/learn-modern-javascript-methods-by-building-football-team-cards/meta.json index b123b93b320..71c76d1ab9b 100644 --- a/curriculum/challenges/_meta/learn-modern-javascript-methods-by-building-football-team-cards/meta.json +++ b/curriculum/challenges/_meta/learn-modern-javascript-methods-by-building-football-team-cards/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-recursion-by-building-a-decimal-to-binary-converter/meta.json b/curriculum/challenges/_meta/learn-recursion-by-building-a-decimal-to-binary-converter/meta.json index cd4c2296e23..24b32fd0d1d 100644 --- a/curriculum/challenges/_meta/learn-recursion-by-building-a-decimal-to-binary-converter/meta.json +++ b/curriculum/challenges/_meta/learn-recursion-by-building-a-decimal-to-binary-converter/meta.json @@ -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": "", diff --git a/curriculum/challenges/_meta/learn-regular-expressions-by-building-a-spam-filter/meta.json b/curriculum/challenges/_meta/learn-regular-expressions-by-building-a-spam-filter/meta.json index 0d2d87bf4e5..9087aa7c6c4 100644 --- a/curriculum/challenges/_meta/learn-regular-expressions-by-building-a-spam-filter/meta.json +++ b/curriculum/challenges/_meta/learn-regular-expressions-by-building-a-spam-filter/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/learn-the-date-object-by-building-a-date-formatter/meta.json b/curriculum/challenges/_meta/learn-the-date-object-by-building-a-date-formatter/meta.json index 4fd038982c6..b911137cec7 100644 --- a/curriculum/challenges/_meta/learn-the-date-object-by-building-a-date-formatter/meta.json +++ b/curriculum/challenges/_meta/learn-the-date-object-by-building-a-date-formatter/meta.json @@ -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": [], diff --git a/curriculum/challenges/_meta/review-js-fundamentals-by-building-a-gradebook-app/meta.json b/curriculum/challenges/_meta/review-js-fundamentals-by-building-a-gradebook-app/meta.json new file mode 100644 index 00000000000..932737bba0a --- /dev/null +++ b/curriculum/challenges/_meta/review-js-fundamentals-by-building-a-gradebook-app/meta.json @@ -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" +} \ No newline at end of file diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md new file mode 100644 index 00000000000..286128cc2cf --- /dev/null +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md @@ -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-- +``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md new file mode 100644 index 00000000000..442b8e44ea9 --- /dev/null +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md @@ -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-- +``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md new file mode 100644 index 00000000000..28f0a467456 --- /dev/null +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md @@ -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-- +``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md new file mode 100644 index 00000000000..bc2df39b43e --- /dev/null +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md @@ -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.`; +} + +```