A simple gradebook app with that can calculate an average, convert a number range to a letter, check if a student failed or passed and print out a message.
Using node.js, the user can enter a a set number of grades (maximum of 6) and the program will calculate the average and then convert the average score into a letter grade and informs the user if they passed or failed based on the average.
Description | Features | Technologies Used | Installation | Usage | Result | Credits
-
Calculates an average: The app calculates the average of a set of scores using a "for" statement.
-
Converts a number range to a letter: It converts a numerical score range to a letter grade using an "if" statement.
-
Checks if a student has passed or failed: The app uses true/false boolean values to determine if a student has passed or failed.
-
Prints out a message: It can print out a message to indicate a student's grade and pass/fail status using already declared functions.
- JavaScript
- Node.js
- Jest
- Clone the repository to your local machine.
- Install the necessary dependencies using
npm install --save-dev jest
.
- To run the tests, type
npx jest
in the terminal from the root directory of the project.
Open your terminal and navigate to the directory containing the script files.
- Run this script in your terminal:
node script.js
Follow the prompts:
- Enter the number of grades (max 6).
- Enter each grade when prompted.
- The script will then calculate the average, determine the letter grade, and display a message indicating whether you passed or failed.
Example:
Initially designed, written and tested with FreeCodeCamp.. This mini project is part of the JavaScript Algorithm and Data Structures Certification, which teaches JavaScript fundamentals like variables, arrays, objects, loops, functions, the DOM, Object Oriented Programming (OOP), Functional Programming, algorithmic thinking, how to work with local storage, and how to fetch data using an API.
- Interactive Command-Line Interface: The script interacts with the user via the terminal, asking for the number of grades and the grades themselves.
- Validation: Ensures the number of grades entered is between 1 and 6 and each grade is between 0 and 100.
- Pass/Fail Notification: Informs the user if they passed or failed based on the calculated average.
These changes were made to both personalize the project and improve upon the initial design, ensuring a more polished and efficient final product.