diff --git a/.gitignore b/.gitignore
index 42fc2e7..6c1d11d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,3 @@
+!**/*.svg
*.log
.DS_Store
-
-
-
-
-
-
diff --git a/README.md b/README.md
index e0961dc..81dbbe3 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,31 @@
# Gradebook App
-In this mini project, you will get to
-review JavaScript fundamentals like functions,
+
+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
+This will give you an opportunity to solve
small problems and get a better understanding of the basics.
-
-
+
+### Technologies
+
+
+
#### - [Full Code](#full-code)
- [Step 1](#step-1)
@@ -18,27 +37,29 @@ small problems and get a better understanding of the basics.
- [Step 4](#step-4)
- [Step 4 Solution](#step-4-solution)
+#### - [back to top](#gradebook-App)
+
### Step 1
-A teacher has finished grading their students'
+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
+Complete the getAverage function which takes
in an array of test scores and returns the average score.
-The average is calculated by adding
+The average is calculated by adding
up all the scores and dividing by the total number of scores.
average = sum of all scores / total number of scores
-A couple of function calls have been
+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
+You can use a loop to iterate
over the scores array and add up all the scores.
-You can use the length property
+You can use the length property
to get the total number of scores.
### Step 1 Solution
@@ -52,17 +73,19 @@ 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]));
```
+#### - [back to top](#gradebook-App)
+
### Step 2
-Now the teacher needs your help
+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
+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
+Here are the scores and their
corresponding letter grades:
Score Range Grade
@@ -93,7 +116,7 @@ Remember that you learned about comparison operators (>, <, >=, <=, ===).
for (const [grade, condition] of Object.entries(grades)) {
if (condition) {
- return grade;
+ return grade;
}
}
}
@@ -103,6 +126,8 @@ console.log(getGrade(82));
console.log(getGrade(56));
```
+#### - [back to top](#gradebook-App)
+
### Step 3
The teacher is really happy with the
@@ -132,6 +157,7 @@ Use the getGrade function to get the
student's grade. Then check if the
grade is passing or not.
+#### - [back to top](#gradebook-App)
### Step 4
@@ -170,6 +196,8 @@ function studentMsg(totalScores, studentScore) {
}
```
+#### - [back to top](#gradebook-App)
+
###### Tips
Use the getAverage function to get the class average.
@@ -177,9 +205,11 @@ 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.
+#### - [back to top](#gradebook-App)
+
## Full Code
-```js
+```js
function hasPassingGrade(score) {
return score > 59;
@@ -215,8 +245,4 @@ function studentMsg(totalScores, studentScore) {
}`;
}
```
-
-
-
-
-
+#### - [back to top](#gradebook-App)
diff --git a/end-product/README.md b/end-product/README.md
new file mode 100644
index 0000000..ae9d849
--- /dev/null
+++ b/end-product/README.md
@@ -0,0 +1,247 @@
+# Gradebook App
+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.
+
+### Technologies
+
+
+
+#### - [Full Code](#full-code)
+
+- [Step 1](#step-1)
+ - [Step 1 Solution](#step-1-solution)
+- [Step 2](#step-2)
+ - [Step 2 Solution](#step-2-solution)
+- [Step 3](#step-3)
+ - [Step 3 Solution](#step-3-solution)
+- [Step 4](#step-4)
+ - [Step 4 Solution](#step-4-solution)
+
+#### - [back to top](#gradebook-App)
+
+### Step 1
+
+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.
+
+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.
+
+### Step 1 Solution
+
+```js
+function getAverage(scores) {
+ return scores.reduce((a, b) => a + b, 0) / scores.length;
+}
+
+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]));
+```
+
+#### - [back to top](#gradebook-App)
+
+### Step 2
+
+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 (>, <, >=, <=, ===).
+
+### Step 2 Solution
+
+```js
+ function getGrade(score) {
+ const grades = {
+ "A++": score > 99,
+ "A": score > 89,
+ "B": score > 79,
+ "C": score > 69,
+ "D": score > 59,
+ "F": score <= 59
+ };
+
+ for (const [grade, condition] of Object.entries(grades)) {
+ if (condition) {
+ return grade;
+ }
+ }
+}
+
+console.log(getGrade(96));
+console.log(getGrade(82));
+console.log(getGrade(56));
+```
+
+#### - [back to top](#gradebook-App)
+
+### Step 3
+
+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.
+
+### Step 3 Solution
+
+```js
+
+function hasPassingGrade(score) {
+ return score > 59;
+}
+
+```
+
+###### Tips
+
+Use the getGrade function to get the
+student's grade. Then check if the
+grade is passing or not.
+
+#### - [back to top](#gradebook-App)
+
+### Step 4
+
+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:
+
+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:
+
+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.
+
+### Step 4 Solution
+
+```js
+function studentMsg(totalScores, studentScore) {
+ const average = getAverage(totalScores);
+ const studentGrade = getGrade(studentScore);
+ const passed = hasPassingGrade(studentScore);
+ return `Class average: ${average}. Your grade: ${studentGrade}. ${
+ passed ? "You passed the course." : "You failed the course."
+ }`;
+}
+```
+
+#### - [back to top](#gradebook-App)
+
+###### 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.
+
+#### - [back to top](#gradebook-App)
+
+## Full Code
+
+```js
+
+function hasPassingGrade(score) {
+ return score > 59;
+}
+
+function getAverage(scores) {
+ return scores.reduce((a, b) => a + b, 0) / scores.length;
+}
+
+function getGrade(score) {
+ const grades = {
+ "A++": score > 99,
+ A: score > 89,
+ B: score > 79,
+ C: score > 69,
+ D: score > 59,
+ F: score <= 59,
+ };
+
+ for (const [grade, condition] of Object.entries(grades)) {
+ if (condition) {
+ return grade;
+ }
+ }
+}
+
+function studentMsg(totalScores, studentScore) {
+ const average = getAverage(totalScores);
+ const studentGrade = getGrade(studentScore);
+ const passed = hasPassingGrade(studentScore);
+ return `Class average: ${average}. Your grade: ${studentGrade}. ${
+ passed ? "You passed the course." : "You failed the course."
+ }`;
+}
+```
+#### - [back to top](#gradebook-App)
diff --git a/end-product/__4__.title__.txt b/end-product/__4__.title__.txt
new file mode 100644
index 0000000..7775fa4
--- /dev/null
+++ b/end-product/__4__.title__.txt
@@ -0,0 +1,31 @@
+Step 4
+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:
+
+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:
+
+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.
+
+
diff --git a/end-product/gradeBookApp.js b/end-product/gradeBookApp.js
new file mode 100644
index 0000000..d5caa5f
--- /dev/null
+++ b/end-product/gradeBookApp.js
@@ -0,0 +1,36 @@
+function studentMsg(totalScores, studentScore) {
+ const average = getAverage(totalScores);
+ const studentGrade = getGrade(studentScore);
+ const passed = hasPassingGrade(studentScore);
+ return `Class average: ${average}. Your grade: ${studentGrade}. ${
+ passed ? "You passed the course." : "You failed the course."
+ }`;
+}
+
+function hasPassingGrade(score) {
+ return score > 59;
+}
+
+function getAverage(scores) {
+ return scores.reduce((a, b) => a + b, 0) / scores.length;
+}
+
+function getGrade(score) {
+ const grades = {
+ "A++": score > 99,
+ A: score > 89,
+ B: score > 79,
+ C: score > 69,
+ D: score > 59,
+ F: score <= 59,
+ };
+
+ for (const [grade, condition] of Object.entries(grades)) {
+ if (condition) {
+ return grade;
+ }
+ }
+}
+
+console.log(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100));
+console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));
diff --git a/icons/javascript-1.svg b/icons/javascript-1.svg
new file mode 100644
index 0000000..b56c0b7
--- /dev/null
+++ b/icons/javascript-1.svg
@@ -0,0 +1 @@
+
\ No newline at end of file