代码拉取完成,页面将自动刷新
import java.util.*;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
public class Score {
public static void main(String a[]) throws FileNotFoundException, IOException {
//准备配置文件
Properties p=new Properties();
p.load(new FileInputStream("D:\\eclipse-workspace\\01\\srctotal.properties"));
Enumeration<?> fileName = p.propertyNames();
//获取配置文件的键值
double ScoreBefore = Integer.parseInt(p.getProperty("before"));
double ScoreBase = Integer.parseInt(p.getProperty("base"));
double ScoreTest = Integer.parseInt(p.getProperty("test"));
double ScoreProgram = Integer.parseInt(p.getProperty("program"));
double ScoreAdd = Integer.parseInt(p.getProperty("add"));
//导入大小班课活动html文件
File file_small = new File("D:\\eclipse-workspace\\01\\src\\small.html");
File file_all = new File("D:\\eclipse-workspace\\01\\all.html");
/*try {
Document document = Jsoup.parse(new File("E:\\eclipse-java-oxygen-R-win32-x86_64\\eclipse\\Java6384\\work1\\src\\work1\\small.html"), "utf-8");
System.out.println(document);
} catch (IOException e) {
e.printStackTrace();
}*/
getScores(file_small, file_all, ScoreBefore, ScoreBase,ScoreTest, ScoreProgram,
ScoreAdd);
}
//定义获取总分的方法
public static void getScores(File small_File, File all_File, double ScoreBefore, double ScoreBase,
double ScoreTest, double ScoreProgram, double ScoreAdd) throws IOException {
//初始化各部分活动的经验值
int my_Before = 0;
int my_Base = 0;
int my_Test = 0;
int my_Program = 0;
int my_Add = 0;
//使用jsoup爬取html文件内容
org.jsoup.nodes.Document document = Jsoup.parse(small_File, "UTF-8");
org.jsoup.nodes.Document document2 = Jsoup.parse(all_File, "UTF-8");
//计算总分的方法
double AllBefore = my_Before / ScoreBefore * 100 * 0.25;
double AllBase = my_Base / ScoreBase * 100 * 0.3 * 0.95;
double AllTest = my_Test / ScoreTest * 100 * 0.2;
double AllProgram = my_Program / ScoreProgram * 100 * 0.1;
double AllAdd = my_Add / ScoreAdd * 100 * 0.05;
double AllScore = (AllBefore + AllBase + AllTest + AllProgram
+ AllAdd)+6;
System.out.println(AllScore);
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。