学分绩点计算编程java_方便我们计算学分绩点的JavaScript

基于目前我们学校教务处的管理系统, 依靠Javascript的帮忙, 我们可以很方便地计算成绩.

测试用HTML:

style="width: 100%; border-collapse: collapse;">

课程代码

课程名称

课程性质

成绩

补考成绩

重修成绩

学分

绩点

辅修标记

24109505

数据库系统实验

专业基础课

优秀

0.5

4.50

24100320

单片机原理及应用

专业基础选修课

78

2.0

2.80

24100915

UML

校选修课

63

1.5

1.30

24200510

数据库系统课程设计

设计(论文)

优秀

1.0

4.50

24203910

可编程序控制器与工业控制网络课程设计

设计(论文)

良好

1.0

3

JavaScript:

//一学年的平均学分绩点=该学年修全部课程的学分绩点之和÷所修课程的总学分(校选修不计算在内)

//学业成绩平均分=一学年平均学分绩点折合为百分制的得数

//考通过的课程,按实际成绩记分,并给予学分,但其绩点均为“0”。重修的课程在该年度中按不及格科目计算,绩点为0。

function Calculate() {

var table = document.getElementById("DataGrid1");

var totalMark = 0;

var failCount = 0;

var subjectCount = 0;

var totalRate = 0;

var totalRawRate = 0;

for(var i = 1; i < table.rows.length; i++) {

if(table.rows[i].cells[2].innerHTML == "校选修课") continue;

subjectCount++;

var mark = getMark(table.rows[i].cells[3].innerHTML);

if(mark < 60) {

failCount++;

}

totalMark += mark;

totalRate += getMark(table.rows[i].cells[7].innerHTML)

* getMark(table.rows[i].cells[6].innerHTML);

totalRawRate += getMark(table.rows[i].cells[6].innerHTML);

}

var resultRow = document.getElementById("resultRow");

if(!resultRow) {

resultRow = document.createElement("tr");

resultRow.id = "resultRow";

}

resultRow.innerHTML = "";

var results = ["总分:", totalMark, "平均分:", (totalMark/subjectCount).toFixed(3),

"平均学分绩点:", (totalRate/totalRawRate).toFixed(3), "不及格数:",failCount];

for(var i = 0; i < results.length; i++) {

var td = document.createElement("td");

td.innerHTML = results[i];

resultRow.appendChild(td);

}

table.lastChild.appendChild(resultRow);

}

function getMark(markStr) {

switch(markStr) {

case "优秀": return 95;

case "良好": return 85;

case "中等": return 75;

case "及格": return 65;

case "不及格":

case "" :

case " ": return 0;

default: return parseFloat(markStr);

}

}

Calculate();

2fa5135fbd256176fc7b0df4d33c0992.png

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/441369.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【POJ - 2663】Tri Tiling (简单dp)

题干&#xff1a; In how many ways can you tile a 3xn rectangle with 2x1 dominoes? Here is a sample tiling of a 3x12 rectangle. Input Input consists of several test cases followed by a line containing -1. Each test case is a line containing an integer …

【POJ - 1556】The Doors (计算几何,线段相交)

题干&#xff1a; You are to find the length of the shortest path through a chamber containing obstructing walls. The chamber will always have sides at x 0, x 10, y 0, and y 10. The initial and final points of the path are always (0, 5) and (10, 5). Th…

【POJ - 1696】Space Ant (凸包,最小极角,排序)

题干&#xff1a; The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an ant-like creature in the planet Y1999 and called it M11. It has only one eye on the left side of its head and just three feet al…

2019蓝桥杯Java决赛题答案_2019第十届蓝桥杯JavaB组省赛真题详解

目录题解待更新第一题&#xff1a;组队题目描述做为篮球队教练&#xff0c;你须要从如下名单中选出 1 号位至 5 号位各一名球员&#xff0c; 组成球队的首发阵容。每位球员担任 1 号位至 5 号位时的评分以下表所示。请你计算首发阵容 1 号位至 5 号位的评分之和最大多是多少&am…

java map统计学生名单_Java含自己的总结:集合,学生,遍历,ArrayList,Set,Map,泛型,班级,发牌—诗书画唱...

声明一个ArrayList&#xff0c;存储一条学生信息&#xff0c;内容为 1 张三 22 男&#xff0c;将信息进行遍历出来package list;import java.util.ArrayList;import java.util.Iterator;public class student{public static void main(String[] args) {ArrayList jiHe…

java生成world文件_HelloWorld.java文件如何创建?

原创HelloWorld.java文件如何创建&#xff1f;编辑:小丸子 来源:PC下载网时间:2017-10-17 19:55:54相信各位刚接触JAVA的新人都希望尽快编写出自己的第一个程序,今天PC下载网小编和你一起学习HelloWorld程序1.首先我们先点击“开始”—然后是“所有程序”—在然后是“附件”—记…

wifisetting.java_Wifi 笔记 | 启动流程

csd&#xff1a;csdn_of_coder/article/details/51541094aosp: Android OAndroid网络各个模式中&#xff0c;Wifi应该是目前最常用的一种网络方式了&#xff1b;下面就简单介绍下Android中Wifi的启动流程。当我在Setting菜单里点击打开Wifi时&#xff0c;调用的入口函数是WifiM…

java 调用动态链接库_JAVA技巧:JNative调用动态链接库问题(SOS)

动态链接库的方法如下&#xff1a;__declspec(dllexport) ret __stdcall rLachTran(const char *pc_trancode,const char *pc_clicode,const char *pc_orgcode,const char *pc_ttycode,const int i_brandid,const char *pc_reqstamp,const int i_reqseqno,const char *pc_svrip…

【POJ - 3347 】Kadj Squares (计算几何,思维 或 扫描线)

题干&#xff1a; In this problem, you are given a sequence S1, S2, ..., Sn of squares of different sizes. The sides of the squares are integer numbers. We locate the squares on the positive x-y quarter of the plane, such that their sides make 45 degrees w…

按钮开关java代码,Android自定义实现开关按钮代码

我们在应用中经常看到一些选择开关状态的配置文件&#xff0c;做项目的时候用的是android的Switch控件&#xff0c;但是感觉好丑的样子子个人认为还是自定义的比较好&#xff0c;先上个效果图&#xff1a;实现过程&#xff1a;1.准备开关不同状态的两张图片放入drawable中。2.x…

*【CodeForces - 202C 】Clear Symmetry (思维,找规律,特判)

题干&#xff1a; Consider some square matrix A with side n consisting of zeros and ones. There are nrows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. Well denote the element of the matrix wh…

*【CodeForces - 768B】Code For 1 (分治策略,模拟二分思想,模拟线段树思想)

题干&#xff1a; Jon fought bravely to rescue the wildlings who were attacked by the white-walkers at Hardhome. On his arrival, Sam tells him that he wants to go to Oldtown to train at the Citadel to become a maester, so he can return and take the decease…

matlab 自适应噪声对消,基于Matlab的RLS自适应语音噪声对消系统的设计与实现

基于Matlab 的R LS 自适应语音噪声对消系统的设计与实现①肖 哲(湖南工业大学科技学院, 湖南株洲 412008)摘 要:自适应信号处理的理论和技术经过40多年的发展和完善,已逐渐成为人们常用的语音去噪技术.而Matlab 的出现又为其提供了更为方便快捷的方法来对语音信号进行消噪处…

贪心算法 -- 最小延迟调度

转自&#xff1a;https://blog.csdn.net/bqw18744018044/article/details/80285414 总结&#xff1a; 首先&#xff0c;证明贪心的时候交换论证是万能的&#xff01;其次&#xff0c;这一点如果要满足&#xff0c;也就是&#xff0c;如果你要用交换论证法&#xff0c;那么首先…

apache2+支持php7,Ubuntu14.04下配置PHP7.0+Apache2+Mysql5.7

Apache步骤一&#xff1a;安装apacheronyaoubuntu:~$ sudo apt install apache2安装好后&#xff0c;在浏览器上输入localhost(服务器端&#xff0c;请输入你的IP地址)&#xff0c;回车就会看到&#xff1a;PHP7.0步骤二&#xff1a;Ubuntu14.04下的默认源是PHP5.0&#xff0c;…

【CodeForces - 1051D】Bicolorings (dp,类似状压dp)

题干&#xff1a; You are given a grid, consisting of 22 rows and nn columns. Each cell of this grid should be colored either black or white. Two cells are considered neighbours if they have a common border and share the same color. Two cells AA and BB be…

【 HDU - 1796】How many integers can you find (容斥原理,二进制枚举或者dfs)

题干&#xff1a; Now you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any integers in the set. For example, N12, and M-integer set is {2,3}, so there is another set {2,…

【CodeForces - 1027B 】Numbers on the Chessboard (没有营养的找规律题,无聊题)

题干&#xff1a; You are given a chessboard of size nnnn. It is filled with numbers from 11 to n2n2 in the following way: the first ⌈n22⌉⌈n22⌉ numbers from 11 to ⌈n22⌉⌈n22⌉ are written in the cells with even sum of coordinates from left to right f…

【CodeForces - 1060C】Maximum Subrectangle (思维,预处理前缀和,dp,枚举长度)

题干&#xff1a; You are given two arrays aa and bb of positive integers, with length nn and mmrespectively. Let cc be an nmnm matrix, where ci,jai⋅bjci,jai⋅bj. You need to find a subrectangle of the matrix cc such that the sum of its elements is at m…

【Codeforces 631C 】Report(单调栈,思维模拟)

题干&#xff1a; Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that d…