excel 瀵煎叆mysql,src/czy/Score.java · 陈志杨/personal - Gitee.com

package czy;

import java.util.regex.Matcher;

import java.util.regex.Pattern;

import org.jsoup.*;

import org.jsoup.nodes.*;

import org.jsoup.select.Elements;

import java.io.File;

import java.io.FileInputStream;

import java.io.IOException;

import java.util.Properties;

public class Score {

public static void main(String[] args) throws IOException {

<<<<<<< HEAD

// 瀵煎叆鎬诲垎鐨勯厤缃枃浠

=======

// 导入总分的配置文件

>>>>>>> 3a5242b... personal

Properties total = new Properties();

total.load(new FileInputStream("total.properties"));

System.out.println("aaa");

<<<<<<< HEAD

// 瀵煎叆澶у皬鐝璧勬簮

=======

// 导入大小班课资源

>>>>>>> 3a5242b... personal

File small = new File("small.html");

Document docSmall = Jsoup.parse(small, "UTF-8");

File all = new File("all.html");

Document docAll = Jsoup.parse(all, "UTF-8");

<<<<<<< HEAD

// 璇惧爞瀹屾垚閮ㄥ垎鍒嗘暟璁$畻

String totalBase = total.getProperty("base");

double baseScore = 0;

// 璇诲彇鍐呭

baseScore += getScore("璇惧爞瀹屾垚",docSmall.select(".interaction-row"));

// 璇惧爞灏忔祴閮ㄥ垎鍒嗘暟璁$畻

String totalTest = total.getProperty("test");

double testScore = 0;

// 璇诲彇鍐呭

testScore += getScore("璇惧爞灏忔祴",docAll.select(".interaction-row"));

// 璇惧墠鑷祴閮ㄥ垎鍒嗘暟璁$畻

String totalBefore = total.getProperty("before");

double beforeScore = 0;

// 璇诲彇鍐呭

beforeScore += getScore("璇惧墠鑷祴",docAll.select(".interaction-row"));

beforeScore += getScore("璇惧墠鑷祴",docSmall.select(".interaction-row"));

// 缂栫▼棰橀儴鍒嗗垎鏁拌绠

String totalProgram = total.getProperty("program");

double programScore = 0;

// 璇诲彇鍐呭

programScore += getScore("缂栫▼棰",docSmall.select(".interaction-row"));

// 闄勫姞棰橀儴鍒嗗垎鏁拌绠

String totalAdd = total.getProperty("add");

double addScore = 0;

// 璇诲彇鍐呭

addScore += getScore("闄勫姞棰",docSmall.select(".interaction-row"));

// 鏈缁堢殑鍚勯」寰楀垎

=======

// 课堂完成部分分数计算

String totalBase = total.getProperty("base");

double baseScore = 0;

// 读取内容

baseScore += getScore("课堂完成",docSmall.select(".interaction-row"));

// 课堂小测部分分数计算

String totalTest = total.getProperty("test");

double testScore = 0;

// 读取内容

testScore += getScore("课堂小测",docAll.select(".interaction-row"));

// 课前自测部分分数计算

String totalBefore = total.getProperty("before");

double beforeScore = 0;

// 读取内容

beforeScore += getScore("课前自测",docAll.select(".interaction-row"));

beforeScore += getScore("课前自测",docSmall.select(".interaction-row"));

// 编程题部分分数计算

String totalProgram = total.getProperty("program");

double programScore = 0;

// 读取内容

programScore += getScore("编程题",docSmall.select(".interaction-row"));

// 附加题部分分数计算

String totalAdd = total.getProperty("add");

double addScore = 0;

// 读取内容

addScore += getScore("附加题",docSmall.select(".interaction-row"));

// 最终的各项得分

>>>>>>> 3a5242b... personal

double sumBase = (baseScore / Integer.parseInt(totalBase)) * 100 * 0.95;

double sumTest = (testScore / Integer.parseInt(totalTest)) * 100;

double sumBefore = (beforeScore / Integer.parseInt(totalBefore)) * 100;

double sumProgram = (programScore / Integer.parseInt(totalProgram)) * 95;

double sumAdd = (addScore / Integer.parseInt(totalAdd)) * 90;

double sum = sumBase * 0.3 + sumTest * 0.2 + sumBefore * 0.25 + sumProgram * 0.1 + sumAdd * 0.05;

System.out.println(sum);

}

static int getScore(String item,Elements baseDoc) {

int Score = 0;

for (int i = 0; i < baseDoc.size(); i++) {

if (baseDoc.get(i).text().toString().contains(item)) {

<<<<<<< HEAD

// 闈炵孩鑹查儴鍒嗘墠鏈夊垎鏁

if (!baseDoc.get(i).toString().contains("#EC6941")) {

// 寰楀埌 鈥渪x 缁忛獙鈥濋儴鍒

String pattern = "\\w* 缁忛獙";

Pattern r = Pattern.compile(pattern);

Matcher m = r.matcher(baseDoc.get(i).text().toString());

while (m.find()) {

int sc = Integer.parseInt(m.group().replaceAll(" ", "").replaceAll("缁忛獙", "").toString());

=======

// 非红色部分才有分数

if (!baseDoc.get(i).toString().contains("#EC6941")) {

// 得到 “xx 经验”部分

String pattern = "\\w* 经验";

Pattern r = Pattern.compile(pattern);

Matcher m = r.matcher(baseDoc.get(i).text().toString());

while (m.find()) {

int sc = Integer.parseInt(m.group().replaceAll(" ", "").replaceAll("经验", "").toString());

>>>>>>> 3a5242b... personal

return Score += sc;

}

}

}

}

return 0;

}

<<<<<<< HEAD

}

=======

}

>>>>>>> 3a5242b... personal

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值