score在java中是什么意思_Score.java

import java.io.File;

import java.io.FileInputStream;

import java.util.Properties;

import java.util.Scanner;

import org.jsoup.Jsoup;

import org.jsoup.nodes.Document;

import org.jsoup.select.Elements;

public class Score{

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

//读取配置文件--total.properties

Properties p =new Properties();

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

//获取配置文件中各个元素的值

double proBefore = Double.parseDouble(p.getProperty("before"));

double proBase = Double.parseDouble(p.getProperty("base"));

double proTest = Double.parseDouble(p.getProperty("test"));

double proProgram = Double.parseDouble(p.getProperty("program"));

double proAdd = Double.parseDouble(p.getProperty("add"));

//Jsoup解析small.html和all.html

Document document1 = Jsoup.parse(new File("src/small.html"), "utf-8");

Document document2 = Jsoup.parse(new File("src/all.html"), "utf-8");

double htmlBefore=0,htmlBase=0,htmlProgram=0,htmlAdd=0,htmlTest=0;

//计算small.html中获得的经验

if (document1 != null) {

Elements small = document1.getElementsByAttributeValue("class", "interaction-row");

int temp;

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

if (small.get(i).child(1).child(0).toString().contains("课堂完成部分")) {

if (small.get(i).child(1).child(2).toString().contains("已参与 ")) {

Scanner scanner1 = new Scanner(small.get(i).child(1).child(2).children().get(0).children().get(7).text());

temp = scanner1.nextInt();

htmlBefore = htmlBefore + temp;

scanner1.close();

}

} else if (small.get(i).child(1).child(0).toString().contains("课堂小测")) {

if (small.get(i).child(1).child(2).toString().contains("已参与 ")) {

Scanner scanner1 = new Scanner(

small.get(i).child(1).child(2).children().get(0).children().get(7).text());

temp = scanner1.nextInt();

htmlTest = htmlTest + temp;

scanner1.close();

}

} else if (small.get(i).child(1).child(0).toString().contains("编程题")) {

if (small.get(i).child(1).child(2).toString().contains("已参与 ")) {

Scanner scanner1 = new Scanner(

small.get(i).child(1).child(2).children().get(0).children().get(7).text());

temp = scanner1.nextInt();

htmlProgram = htmlProgram + temp;

scanner1.close();

}

} else if (small.get(i).child(1).child(0).toString().contains("附加题")) {

if (small.get(i).child(1).child(2).toString().contains("已参与 ")) {

Scanner scanner1 = new Scanner(

small.get(i).child(1).child(2).children().get(0).children().get(7).text());

temp = scanner1.nextInt();

htmlAdd = htmlAdd + temp;

scanner1.close();

}

} else if (small.get(i).child(1).child(0).toString().contains("课前自测"))

if (small.get(i).child(1).child(2).toString().contains("color:#8FC31F")) {

Scanner scanner1 = new Scanner(

small.get(i).child(1).child(2).children().get(0).children().get(10).text());

temp = scanner1.nextInt();

htmlBefore = htmlBefore + temp;

scanner1.close();

}

}

}

//计算all.html中获得的经验

if (document2 != null) {

Elements all = document2.getElementsByAttributeValue("class", "interaction-row");

int temp1;

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

if (all.get(i).child(1).child(0).toString().contains("课前自测"))

if (all.get(i).child(1).child(2).toString().contains("color:#8FC31F")) {

Scanner scanner2 = new Scanner(

all.get(i).child(1).child(2).children().get(0).children().get(10).text());

temp1 = scanner2.nextInt();

htmlBefore = htmlBefore + temp1;

scanner2.close();

}

}

//计算总得分

double finBefore = htmlBefore/proBefore*0.25*100;

double finBase = htmlBase/proBase*0.3*0.95*100;

double finTest = htmlTest/proTest*0.2*100;

proProgram=95;

double finProgram = htmlProgram/proProgram*0.1*100;

proAdd=90;

double finAdd = htmlAdd/proAdd*0.05*100;

double total=finBefore+finBase+finTest+finProgram+finAdd;

System.out.println(String.format("%.2f",total));

}

}

一键复制

编辑

Web IDE

原始数据

按行查看

历史

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值