1 Star 0 Fork 0

很牛逼啊/personal

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
Score.java 3.41 KB
Copy Edit Raw Blame History
很牛逼啊 authored 2020-09-20 23:58 +08:00 . -m修改互评
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Properties;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class Score {
public static void main(String[] args) throws FileNotFoundException, IOException {
Properties pps = new Properties();
pps.load(new FileInputStream("total.properties"));
Enumeration fileName = pps.propertyNames();
int totalbefore = Integer.parseInt(pps.getProperty("before"));
int totalbase = Integer.parseInt(pps.getProperty("base"));
int totaltest = Integer.parseInt(pps.getProperty("test"));
int totalprogram = Integer.parseInt(pps.getProperty("program"));
int totaladd = Integer.parseInt(pps.getProperty("add"));
double program=0,base=0,before=0,add=0,test=0;
Document small = Jsoup.parse(new File("small.html"), "utf-8");
Elements titleItems = small.getElementsByClass("interaction-row");
for (Element titleItem : titleItems) {
//每题的标题 都是由title属性的span标签
Element title = titleItem.select("span[title]").first();
if(title.text().contains("编程题")) {
program = count(program, titleItem);
}
if(title.text().contains("课堂小测")) {
test = count(test, titleItem);
}
if(title.text().contains("课堂完成")) {
base = count(base, titleItem);
}
if(title.text().contains("附加题")) {
add = count(add, titleItem);
}
if(title.text().contains("课前自测")) {
before = count(before, titleItem);
}
}
Document all = Jsoup.parse(new File("all.html"), "utf-8");
Elements titleItems2 = small.getElementsByClass("interaction-row");
for (Element titleItem : titleItems2) {
//每题的标题 都是由title属性的span标签
Element title = titleItem.select("span[title]").first();
if(title.text().contains("编程题")) {
program = count(program, titleItem);
}
if(title.text().contains("课堂小测")) {
test = count(test, titleItem);
}
if(title.text().contains("课堂完成")) {
base = count(base, titleItem);
}
if(title.text().contains("附加题")) {
add = count(add, titleItem);
}
if(title.text().contains("课前自测")) {
before = count(before, titleItem);
}
}
double beforeexam = before/totalbefore;
double testexam = test/totaltest;
double baseexam = base/totalbase * 0.95;
double programexam = program/totalprogram *0.95;
double addexam = add/totaladd * 0.9;
double sum=(beforeexam*0.3+testexam*0.2+baseexam*0.25+programexam*0.1+addexam*0.05)*100+6;
System.out.println(sum);
}
private static double count(double n, Element titleItem) {
Elements exs = titleItem.select("span[style='color:#8FC31F;']");
//用循环解决互评的可能性
for (Element ex : exs) {
String str = ex.text().trim();
String str2 = "";
if (str != null && !"".equals(str)) {
for (int i = 0; i < str.length(); i ++) {
if (str.charAt(i) >= 48 && str.charAt(i) <= 57) {
str2 += str.charAt(i);
}
}
}
if(!"".equals(str2)) n += Integer.parseInt(str2);
}
return n;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/its_fucking_great/personal.git
git@gitee.com:its_fucking_great/personal.git
its_fucking_great
personal
personal
master

Search