Skip to content

Instantly share code, notes, and snippets.

@szemate
Last active October 16, 2021 08:48
Show Gist options
  • Save szemate/92be535c294564cba339bef10ead1655 to your computer and use it in GitHub Desktop.
Save szemate/92be535c294564cba339bef10ead1655 to your computer and use it in GitHub Desktop.
JS test result grading exercise
/*
TEST RESULT GRADING
We are writing a program for teachers that helps them grade test results.
The program receives the test results as an array of objects; each object
contains the name of a student and their test score (see below).
1. Print the names and the number (the count) of the students who passed the test (had at least 40 points).
2. Print the average score.
3. Print the name of the student who had the highest score.
4. Print the percentages of passes and failures (e.g. 60% passed and 40% failed).
5. Grade the results A-F and print a list of the students' names with their grades.
Use the following grading scale:
- 0-39: F
- 40-54: D
- 55-69: C
- 70-84: B
- 85-100: A
*/
const results = [
{ student: "Gytha Wheatley", score: 44 },
{ student: "Alishia Thorpe", score: 83 },
{ student: "Zack Vernon", score: 59 },
{ student: "Jaclyn Elliott", score: 38 },
{ student: "Ashlynn Albinson", score: 66 },
{ student: "Slade Marchand", score: 24 },
{ student: "Karen Warwick", score: 90 },
{ student: "Michael Foster", score: 65 },
{ student: "Dove Siddall", score: 39 },
{ student: "Frederick Pond", score: 72 },
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment