grading-scale-js 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +7 -0
  2. package/index.js +43 -0
  3. package/package.json +16 -0
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # grading-scale-js
2
+
3
+ A simple JavaScript package that converts numeric marks into letter grades.
4
+
5
+ ## Installation
6
+ ```bash
7
+ npm install grading-scale-js
package/index.js ADDED
@@ -0,0 +1,43 @@
1
+ function grading(marks){
2
+ if( typeof marks !== "number" || marks < 0 || marks > 100){
3
+ return "Please input valid marks";
4
+ }
5
+ let grade;
6
+ switch(true){
7
+ case marks >= 90:
8
+
9
+ return "A";
10
+
11
+ case marks >= 80:
12
+
13
+ return "B";
14
+
15
+ case marks >= 70:
16
+
17
+ return "C";
18
+
19
+ case marks >= 60:
20
+
21
+ return "D";
22
+
23
+ case marks >= 50:
24
+
25
+ return "E";
26
+
27
+ case marks >= 40:
28
+
29
+ return "F";
30
+
31
+ case marks >= 30:
32
+
33
+ return "S";
34
+
35
+ case marks < 30:
36
+
37
+ return "U";
38
+
39
+ default:
40
+ return "Please input valid marks";
41
+ }
42
+ }
43
+ module.exports = grading;
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "grading-scale-js",
3
+ "version": "1.0.0",
4
+ "description": "Convert numeric marks into grades",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [
10
+ "Students",
11
+ "Grading",
12
+ "Marks"
13
+ ],
14
+ "author": "Jean de Dieu",
15
+ "license": "ISC"
16
+ }