Spaces:
Sleeping
Sleeping
File size: 5,197 Bytes
02c8958 |
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
<html><head><base href="https:/nptel-score-calculator/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NPTEL Score Calculator | Hacker's Edition</title>
<style>
body {
font-family: 'Courier New', monospace;
background-color: #001a00;
color: #00ff00;
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background-color: #002200;
border: 2px solid #00ff00;
border-radius: 10px;
padding: 20px;
max-width: 600px;
width: 100%;
box-shadow: 0 0 20px rgba(0, 255, 0, 0.2);
}
h1 {
text-align: center;
margin-bottom: 20px;
text-shadow: 0 0 5px #00ff00;
}
.input-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
gap: 10px;
margin-bottom: 20px;
}
input[type="number"] {
width: 100%;
padding: 5px;
background-color: #001a00;
border: 1px solid #00ff00;
color: #00ff00;
font-family: inherit;
}
button {
background-color: #004400;
color: #00ff00;
border: none;
padding: 10px 20px;
cursor: pointer;
font-family: inherit;
font-size: 16px;
transition: background-color 0.3s;
}
button:hover {
background-color: #006600;
}
#result {
margin-top: 20px;
padding: 10px;
border: 1px solid #00ff00;
background-color: #001a00;
}
.terminal {
position: relative;
padding: 20px;
background-color: #001100;
border-radius: 5px;
margin-bottom: 20px;
overflow: hidden;
}
.terminal::before {
content: "> Sai Somnath Rachamadugu";
display: block;
margin-bottom: 10px;
color: #00aa00;
}
.terminal::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: repeating-linear-gradient(
0deg,
rgba(0, 255, 0, 0.03) 0px,
rgba(0, 255, 0, 0.03) 1px,
transparent 1px,
transparent 2px
);
pointer-events: none;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0; }
}
.cursor {
display: inline-block;
width: 10px;
height: 20px;
background-color: #00ff00;
animation: blink 1s step-end infinite;
}
@media (max-width: 480px) {
.input-container {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="container">
<div class="terminal">
<h1>NPTEL Score Calculator</h1>
<p>Enter your weekly scores below (0-100):</p>
</div>
<div class="input-container">
<input type="number" id="week1" min="0" max="100" placeholder="Week 1">
<input type="number" id="week2" min="0" max="100" placeholder="Week 2">
<input type="number" id="week3" min="0" max="100" placeholder="Week 3">
<input type="number" id="week4" min="0" max="100" placeholder="Week 4">
<input type="number" id="week5" min="0" max="100" placeholder="Week 5">
<input type="number" id="week6" min="0" max="100" placeholder="Week 6">
<input type="number" id="week7" min="0" max="100" placeholder="Week 7">
<input type="number" id="week8" min="0" max="100" placeholder="Week 8">
</div>
<button onclick="calculateScore()">Calculate Score</button>
<button onclick="resetFields()">Reset</button>
<div id="result"></div>
</div>
<script>
function calculateScore() {
const scores = [];
let totalScore = 0;
let validScores = 0;
for (let i = 1; i <= 8; i++) {
const score = parseInt(document.getElementById(week${i}).value);
if (!isNaN(score) && score >= 0 && score <= 100) {
scores.push(score);
totalScore += score;
validScores++;
}
}
if (validScores === 0) {
document.getElementById('result').innerHTML = "Please enter at least one valid score.";
return;
}
let finalScore;
if (validScores === 8) {
finalScore = (totalScore / 800) * 25;
} else if (validScores === 7) {
finalScore = (totalScore / 700) * 25;
} else {
document.getElementById('result').innerHTML = "Please enter scores for either 7 or 8 weeks.";
return;
}
const passed = finalScore >= 10;
const resultColor = passed ? "#00ff00" : "#ff0000";
document.getElementById('result').innerHTML = `
<p>Total Score: ${totalScore}</p>
<p>Final Score (out of 25): ${finalScore.toFixed(2)}</p>
<p style="color: ${resultColor}">
${passed ? "Congratulations! You have passed." : "Sorry, you have failed. Better luck next time!"}
</p>
<span class="cursor"></span>
`;
}
function resetFields() {
for (let i = 1; i <= 8; i++) {
document.getElementById(week${i}).value = "";
}
document.getElementById('result').innerHTML = "";
}
</script>
</body></html> |