学生成绩档案管理系统源代码:
student
public class students{
private String name;
private String number;
private int chinascore;
private int mathscore;
private int englishscore;
private int physcore;
public students(String name, String number, int chinascore, int mathscore, int englishscore, int physcore) {
this.name = name;
this.number = number;
this.chinascore = chinascore;
this.mathscore = mathscore;
this.englishscore = englishscore;
this.physcore = physcore;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public int getChinascore() {
return chinascore;
}
public void setChinascore(int chinascore) {
this.chinascore = chinascore;
}
public int getMathscore() {
return mathscore;
}
public void setMathscore(int mathscore) {
this.mathscore = mathscore;
}
public int getEnglishscore() {
return englishscore;
}
public void setEnglishscore(int englishscore) {
this.englishscore = englishscore;
}
public int getPhyscore() {
return physcore;
}
public void setPhyscore(int physcore) {
this.physcore = physcore;
}
}
database
import java.util.ArrayList;
import java.util.List;
public class database {
List<students> studentsList = new ArrayList<>();
public database() {
studentsList.add(new students("张三", "1", 1, 1, 1, 1));
studentsList.add(new students("李四", "2", 8, 2, 2, 2));
studentsList.add(new students("王五", "3", 1, 3, 3, 3));
studentsList.add(new students("赵六", "4", 6, 4, 4, 4));
}
public List<students> getStudentsList() {
return studentsList;
}
public void setStudentsList(List<students> studentsList) {
this.studentsList = studentsList;
}
}
studentdao
import java.util.List;
import java.util.Scanner;
public class studentdao {
database database;
public studentdao(database dataBase) {
this.database = dataBase;
}
//对全部学生信息打印
public void print() {
List<students> list = database.getStudentsList();
System.out.println("学生学号:" + "学生姓名" + " 语文:" + "数学:" + "英语:" + "物理:"+"学生总分");
for (students students : database.getStudentsList()) {
int x=students.getChinascore()+students.getMathscore()+students.getEnglishscore()+students.getPhyscore();
System.out.println("" + students.getNumber() + " " + students.getName() + " " + students.getChinascore()
+ " " + students.getMathscore() + " " + students.getEnglishscore() + " " + students.getPhyscore()+" "+x);
}
for(int i=0;i<=list.size();i++){
int x=list.get(i).getChinascore()+list.get(i).getMathscore() +list.get(i).getEnglishscore()+list.get(i).getPhyscore();
System.out.println((i+1)+list.get(i).getNumber()+list.