Spaces:
Running
Running
File size: 1,004 Bytes
85af964 f78ceec |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
---
title: Gradecalculator
emoji: 🐢
colorFrom: purple
colorTo: indigo
sdk: static
pinned: false
license: mit
short_description: How GradeCalculator.college Works
---
# GradeCalculator.college
An easy-to-use grade calculator that computes weighted grades for students.
## How it works
Takes score and weight input, calculates weighted score using JavaScript.
### Demo snippet
```html
<input id="score" type="number" placeholder="Score" />
<input id="weight" type="number" placeholder="Weight (%)" />
<button onclick="calculateGrade()">Calculate</button>
<div id="result"></div>
<script>
function calculateGrade() {
const score = parseFloat(document.getElementById('score').value);
const weight = parseFloat(document.getElementById('weight').value);
if(isNaN(score) || isNaN(weight)) {
alert('Please enter valid numbers');
return;
}
const weighted = (score * weight) / 100;
document.getElementById('result').textContent = 'Weighted Score: ' + weighted.toFixed(2);
}
</script>
|