考研分数计算神器
简述
随着考研分数逐渐出来以后,为了方便计算考研最终的分数而开发出来的一个分数计算工具(一个html页面)。该工具能够同时计算两个人的最终分数,以及相差的分数,还包括落后者需要复试多少分才能够逆风翻盘!!!
一、计算算法
初试复试占比6:4是指在计算总成绩时,初试成绩占比60%,复试成绩占比40%(可以根据自己实际情况修改)。具体的计算方法可能因学校和专业而有所不同,以下是两种常见的计算方法: 成绩=100x(初试成绩/初试满分)x60%+100x (复试成绩/复试满分)x40%。 总成绩=初试成绩x60%+复试成绩x40%!(其中笔试以及复试比例可以进行修改,默认是6:4, 笔试满分以及复试满分也可以修改, 默认是500和200)
二、使用步骤
1. 打开文件
- 电脑直接双击即可
- 手机请使用浏览器打开(鸿蒙和安卓系统手机可以选择打开方式时选择浏览器打开,苹果手机自带浏览器似乎打开需要自己下一个QQ浏览器或者其他的浏览器)
截图如下(示例):
2.修改笔试、复试比例,以及笔试、复试满分分数
截图如下(示例):
提示:需要将复试满分、笔试满分、笔试所占比例、复试所占比例填写完整
3.填写分数
- 如果只计算自己的综合分数可以只输入一个人的笔试分数和复试分数即可
- 点击计算
- 两个人分数输入完整时
效果如下:
提示:分数请输入数字!!!!!!!!
4.源码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>计算分数</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
}
.container {
max-width: 600px;
margin: 50px auto;
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}
h1 {
text-align: center;
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 10px;
}
input[type="number"] {
width: 100%;
padding: 5px;
margin-bottom: 20px;
}
button {
display: block;
width: 100%;
padding: 10px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container" id="countForm" style="display: block;">
<form>
<small style="color: red;">初试复试占比6:4是指在计算总成绩时,初试成绩占比60%,复试成绩占比40%(可以根据自己实际情况修改)。具体的计算方法可能因学校和专业而有所不同,以下是两种常见的计算方法:
成绩=100x(初试成绩/初试满分)x60%+100x
(复试成绩/复试满分)x40%。
总成绩=初试成绩x60%+复试成绩x40%</small>
<label for="firstFull">笔试满分分数:</label>
<input type="number" id="firstFull" value="500" required>
<label for="secondFull">复试满分分数:</label>
<input type="number" id="secondFull" value="200" required>
<label for="firstRate">笔试所占比例:</label>
<input type="number" id="firstRate" value="0.6" min="0" max="1" required>
<label for="secondRate">复试所占比例</label>
<input type="number" id="secondRate" value="0.4" min="0" max="1" required>
</form>
<h1 id="myTitle">请输入分数</h1>
<form>
<label for="mySelfFirstScore">第一个人笔试分数:</label>
<input type="number" id="mySelfFirstScore" value="421" required>
<label for="mySelfSecondScore">第一个人复试分数:</label>
<input type="number" id="mySelfSecondScore" value="150" required>
<label for="otherFirstScore">第二个人笔试分数:</label>
<input type="number" id="otherFirstScore" required>
<label for="otherSecondScore">第二个人复试分数:</label>
<input type="number" id="otherSecondScore">
<button type="submit" onclick="count(event)">计算</button>
</form>
</div>
<div class="container" id="ResultForm" style="display: none;">
<h1 id="myTitle">请输入分数</h1>
<h2 id="firstResult">4234</h2>
<h2 id="secondResult"></h2>
<h2 id="result"></h2>
<button onclick="hiddenResultForm()">返回</button>
</div>
</body>
<script>
var firstResult = ""
var secondResult = ""
var temp = ""
var reuslt = ""
var test = "这是一个动态显示的标题";
document.getElementById("myTitle").innerHTML = "请完整输入分数";
function hiddenCountForm() {
var x = document.getElementById("countForm");
x.style.display = "none"
var y = document.getElementById("ResultForm");
y.style.display = "block"
}
function hiddenResultForm() {
var x = document.getElementById("countForm");
x.style.display = "block"
var y = document.getElementById("ResultForm");
y.style.display = "none"
}
//初始满分
var firstFull = 500;
//复试满分
var secondFull = 200;
var firstRate = 0.6;
var secondRate =0.4;
var mySelfFirstScore = 342;
var mySelfSecondScore = 171.800;
var otherFirstScore = 337;
var otherSecondScore = 172.000;
function count(event) {
event.preventDefault(); // 阻止表单默认提交行为,不然总是会刷新
console.log(document.getElementById('firstFull').value)
firstFull = parseFloat(document.getElementById('firstFull').value);
secondFull = parseFloat(document.getElementById('secondFull').value);
firstRate = parseFloat(document.getElementById('firstRate').value);
secondRate = parseFloat(document.getElementById('secondRate').value);
mySelfFirstScore = parseFloat(document.getElementById('mySelfFirstScore').value);
mySelfSecondScore = parseFloat(document.getElementById('mySelfSecondScore').value);
otherFirstScore = parseFloat(document.getElementById('otherFirstScore').value);
otherSecondScore = parseFloat(document.getElementById('otherSecondScore').value);
// this.hiddenCountForm();
show(mySelfFirstScore, mySelfSecondScore, otherFirstScore, otherSecondScore);
}
function show(mySelfFirstScore, mySelfSecondScore, otherFirstScore, otherSecondScore) {
this.firstResult = ""
this.firstResult += "第一个人:分数计算如下<br>"
let myselfTotal = showTotal(mySelfFirstScore, mySelfSecondScore);
this.firstResult += this.temp
this.secondResult = "第二个人: 计算分数如下<br>"
let otherTotal = showTotal(otherFirstScore, otherSecondScore);
this.secondResult += this.temp;
this.result = ""
if (myselfTotal > otherTotal) {
this.result += "第一个人超过了第二个人的综合分数" + myselfTotal + " > " + otherTotal + "<br>"
this.result += "第二个人需要复试" + overMyselfNeedSecondScore(otherFirstScore) + "分才能实现反超"
} else if (myselfTotal === otherTotal) {
this.result += "第一个人和综合人数相等" + myselfTotal + " = " + otherTotal
} else if (myselfTotal < otherTotal) {
this.result += "第一个人小于第二个人的综合分数:" + myselfTotal + " < " + otherTotal + "<br>"
this.result += "第一个人需要复试" + overOtherNeedSecondScore() + "分才能实现反超"
}
this.hiddenCountForm();
document.getElementById("firstResult").innerHTML = this.firstResult;
document.getElementById("secondResult").innerHTML = this.secondResult;
document.getElementById("result").innerHTML = this.result;
}
function showTotal(firstScore, secondScore) {
let totalScore = countTotal(firstScore, secondScore);
this.temp = ""
this.temp += "笔试分数:" + firstScore + "/" + firstFull + "<br>" +
"复试分数:" + secondScore + "/" + secondFull + "<br>" +
"综合分数:" + totalScore + "<br>---------------------------"
return totalScore;
}
function overOtherNeedSecondScore() {
let otherTotal = countTotal(otherFirstScore, otherSecondScore);
let myFirstTotal = countFirstTotal(mySelfFirstScore);
let differenceScore = otherTotal - myFirstTotal;
let needSecondScore = countSecond(differenceScore);
return needSecondScore;
}
function overMyselfNeedSecondScore(firstScore) {
let myselfTotal = countTotal(mySelfFirstScore, mySelfSecondScore);
let otherFirst = countFirstTotal(firstScore);
let differenceScore = myselfTotal - otherFirst;
return countSecond(differenceScore);
}
function countSecond(differenceScore) {
let secondFirst = (differenceScore / secondRate / 100 * secondFull).toFixed(2);
return parseFloat(secondFirst); // 将字符串转换为数字
}
function countFirstTotal(firstScore) {
let first = (firstScore / firstFull * 100 * firstRate).toFixed(2);
return parseFloat(first); // 将字符串转换为数字
}
function countTotal(firstScore, secondScore) {
let totalScore = ((firstScore / firstFull * 100 * firstRate) + (secondScore / secondFull * 100 * secondRate)).toFixed(2);
return parseFloat(totalScore); // 将字符串转换为数字
}
</script>
</html>
复制到记事本,然后修改文件后缀为.html即可,然后就可以双击打开了
5. 资源下载
可以查看我的主页资源,可以免费下载(不需要会员,不需要积分!!!直接下载!!!!)
总结
祝福各位能够取得一个理想的分数,进入理想的高校,人人都有学上
标签:分数,复试,getElementById,开箱,let,var,document,即用,考研 From: https://blog.csdn.net/qq_45774406/article/details/137126844