高校人员信息管理系统 1、数据模型 教师、实验员、行政人员、教师兼行政人员 共有属性:编号、姓名、性别、出生年月 教师:所在系部、专业、职称 实验员:所在实验室、职称 行政人员:政治面貌、职务
package operation;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import dao.add;
import dao.all;
import dao.count;
import dao.del;
import dao.edit;
import dao.sorr;
import domain.da;
import domain.xiao;
import domain.zhong;
public class op {
public static void show1()
{
System.out.println(" 欢迎使用学生成绩管理系统");
System.out.println("*********1.增加信息*********");
System.out.println("*********2.删除信息*********");
System.out.println("*********3.修改信息*********");
System.out.println("*********4.查看信息*********");
System.out.println("*********5.统计信息*********");
System.out.println("*********6.总分排序*********");
System.out.println("*********7.退出系统*********");
System.out.println("请选择:");
}
public static void show2()
{
System.out.println(" 欢迎使用学生成绩管理系统 ");
System.out.println("*********1.小学生********");
System.out.println("*********2.中学生********");
System.out.println("*********3.大学生********");
System.out.println("*************************");
System.out.println("请选择:");
}
public static void show3()
{
System.out.println(" 欢迎使用学生成绩管理系统 ");
System.out.println("*********1.课 程********");
System.out.println("*********2.分数段********");
System.out.println("*********3.班 级********");
System.out.println("*************************");
System.out.println("请选择:");
}
public static void write(ArrayList<xiao> a,ArrayList<zhong> b,ArrayList<da> c){
ObjectOutputStream oos ;
try {
oos = new ObjectOutputStream( new BufferedOutputStream(new FileOutputStream( "D://low.txt" )));
oos .writeObject(a);
oos .close();
} catch (IOException e ) {
// TODO Auto-generated catch block
e .printStackTrace();
}
try {
oos = new ObjectOutputStream( new BufferedOutputStream(new FileOutputStream( "D://mid.txt" )));
oos .writeObject(b);
oos .close();
} catch (IOException e ) {
// TODO Auto-generated catch block
e .printStackTrace();
}
try {
oos = new ObjectOutputStream( new BufferedOutputStream(new FileOutputStream( "D://high.txt" )));
oos .writeObject(c);
oos .close();
} catch (IOException e ) {
// TODO Auto-generated catch block
e .printStackTrace();
}
System.out.println("**************写入成功**************");
}
public static ArrayList<xiao> read1()
{
ArrayList<xiao> a =new ArrayList<>(); ;
File f = new File("D://low.txt" );
if(f.exists() == false)
return a;
try {
ObjectInputStream ois = new ObjectInputStream( new BufferedInputStream( new FileInputStream( "D://low.txt" )));
a =(ArrayList<xiao>) ois.readObject();
ois .close();
} catch (IOException e ) {
// TODO Auto-generated catch block
e .printStackTrace();
} catch (ClassNotFoundException e ) {
// TODO Auto-generated catch block
e .printStackTrace();
}
return a;
}
public static ArrayList<zhong> read2()
{
ArrayList<zhong> b =new ArrayList<>(); ;
File f = new File("D://mid.txt" );
if(f.exists() == false)
return b;
try {
ObjectInputStream ois = new ObjectInputStream( new BufferedInputStream( new FileInputStream( "D://mid.txt" )));
b =(ArrayList<zhong>) ois.readObject();
ois .close();
} catch (IOException e ) {
// TODO Auto-generated catch block
e .printStackTrace();
} catch (ClassNotFoundException e ) {
// TODO Auto-generated catch block
e .printStackTrace();
}
return b ;
}
public static ArrayList<da> read3()
{
ArrayList<da> c =new ArrayList<>(); ;
File f = new File("D://high.txt" );
if(f.exists() == false)
return c;
try {
ObjectInputStream ois = new ObjectInputStream( new BufferedInputStream( new FileInputStream( "D://high.txt" )));
c =(ArrayList<da>) ois.readObject();
ois .close();
} catch (IOException e ) {
// TODO Auto-generated catch block
e .printStackTrace();
} catch (ClassNotFoundException e ) {
// TODO Auto-generated catch block
e .printStackTrace();
}
return c ;
}
public static void main(String[] args) {
ArrayList<xiao> x = read1();
ArrayList<zhong> z = read2();
ArrayList<da> d = read3();
boolean flag = true;
Scanner input = new Scanner(System.in);
do {
show1();
int c = input.nextInt();
switch (c) {
case 1:
System.out.println("添加:");
show2();
int n = input.nextInt();
add a = new add();
if(n == 1) a.addxiao(x);
else if(n == 2) a.addzhong(z);
else a.addda(d);
break;
case 2:
System.out.println("删除");
show2();
int xx = input.nextInt();
del dd = new del();
if(xx == 1) dd.del1(x);
else if(xx == 2) dd.del2(z);
else dd.del3(d);
break;
case 3:
System.out.println("修改");
show2();
int yy = input.nextInt();
edit e = new edit();
if(yy == 1) e.edit1(x);
else if(yy == 2) e.edit2(z);
else e.edit3(d);
break;
case 4:
System.out.println("查看");
show2();
int zz = input.nextInt();
all al = new all();
if(zz == 1) al.mes1(x);
else if(zz == 2) al.mes2(z);
else al.mes3(d);
break;
case 5:
System.out.println("统计");
show3();
count uu = new count();
int hh = input.nextInt();
if(hh == 1) uu.course(x, z, d);
else if(hh == 2) uu.grade(x, z, d);
else uu.cla(x, z, d);
break;
case 6:
System.out.println("排序");
show2();
int kk = input.nextInt();
sorr s = new sorr();
if(kk == 1) s.paixu1(x);
else if(kk == 2) s.paixu2(z);
else s.paixu3(d);
break;
case 7:
System.out.println("您已退出");
break;
default:
System.out.println("输入序号错误,请重新输入");
}
if(c == 7) flag = false;
}while(flag == true);
write(x,z,d);
}
}
package domain;
import java.io.Serializable;
public class da extends same implements Comparable<da>,Serializable{
int zy;
int gdsx;
int ks;
int cnt = 0;
public da()
{
}
public da(int zy, int gdsx, int ks) {
super();
this.zy = zy;
this.gdsx = gdsx;
this.ks = ks;
}
public int getZy() {
return zy;
}
public void setZy(int zy) {
this.zy = zy;
}
public int getGdsx() {
return gdsx;
}
public void setGdsx(int gdsx) {
this.gdsx = gdsx;
}
public int getKs() {
return ks;
}
public void setKs(int ks) {
this.ks = ks;
}
public int getCnt() {
return cnt;
}
public void setCnt(int cnt) {
this.cnt = cnt;
}
@Override
public int compareTo(da o) {
// TODO Auto-generated method stub
return o.cnt - this.cnt;
}
}
package domain;
import java.io.Serializable;
public class same implements Serializable{
//学号、姓名、出生年月、性别、班级
String id;
String name;
String birth;
String sex;
String clas;
public same()
{
}
public same(String id, String name, String birth, String sex, String clas) {
super();
this.id = id;
this.name = name;
this.birth = birth;
this.sex = sex;
this.clas = clas;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBirth() {
return birth;
}
public void setBirth(String birth) {
this.birth = birth;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getClas() {
return clas;
}
public void setClas(String clas) {
this.clas = clas;
}
}
package domain;
import java.io.Serializable;
public class xiao extends same implements Comparable<xiao>,Serializable {
//英语、数学、语文成绩
int ying;
int shu;
int yu;
int cnt = 0;
public xiao()
{
}
public xiao(int ying, int shu, int yu) {
super();
this.ying = ying;
this.shu = shu;
this.yu = yu;
}
public int getYing() {
return ying;
}
public void setYing(int ying) {
this.ying = ying;
}
public int getShu() {
return shu;
}
public void setShu(int shu) {
this.shu = shu;
}
public int getYu() {
return yu;
}
public void setYu(int yu) {
this.yu = yu;
}
public int getCnt() {
return cnt;
}
public void setCnt(int cnt) {
this.cnt = cnt;
}
@Override
public int compareTo(xiao o) {
// TODO Auto-generated method stub
return o.cnt - this.cnt;
}
}
|