Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
|
@@ -9,4 +9,31 @@ license: mit
|
|
| 9 |
short_description: How GradeCalculator.college Works
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
short_description: How GradeCalculator.college Works
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# GradeCalculator.college
|
| 13 |
+
|
| 14 |
+
An easy-to-use grade calculator that computes weighted grades for students.
|
| 15 |
+
|
| 16 |
+
## How it works
|
| 17 |
+
|
| 18 |
+
Takes score and weight input, calculates weighted score using JavaScript.
|
| 19 |
+
|
| 20 |
+
### Demo snippet
|
| 21 |
+
|
| 22 |
+
```html
|
| 23 |
+
<input id="score" type="number" placeholder="Score" />
|
| 24 |
+
<input id="weight" type="number" placeholder="Weight (%)" />
|
| 25 |
+
<button onclick="calculateGrade()">Calculate</button>
|
| 26 |
+
<div id="result"></div>
|
| 27 |
+
|
| 28 |
+
<script>
|
| 29 |
+
function calculateGrade() {
|
| 30 |
+
const score = parseFloat(document.getElementById('score').value);
|
| 31 |
+
const weight = parseFloat(document.getElementById('weight').value);
|
| 32 |
+
if(isNaN(score) || isNaN(weight)) {
|
| 33 |
+
alert('Please enter valid numbers');
|
| 34 |
+
return;
|
| 35 |
+
}
|
| 36 |
+
const weighted = (score * weight) / 100;
|
| 37 |
+
document.getElementById('result').textContent = 'Weighted Score: ' + weighted.toFixed(2);
|
| 38 |
+
}
|
| 39 |
+
</script>
|