1 Star 0 Fork 0

何淑彬/personal

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Score.java 2.45 KB
一键复制 编辑 原始数据 按行查看 历史
何淑彬 提交于 2020-09-11 12:47 +08:00 . 第一次个人编程作业
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);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/he-shubin/personal.git
git@gitee.com:he-shubin/personal.git
he-shubin
personal
personal
master

搜索帮助