高校人员信息管理系统-java软件代码

import java.io.*;
import java.util.*;

class Person implements Serializable 
{
	 protected String id;  //员工编号
	    protected String name;  //姓名
	    protected String gender;  //性别
	    protected int age;  //年龄
	    
	    Person(String id, String name, String gender, int age) {
	        this.id = id;
	        this.name = name;
	        this.gender = gender;
	        this.age = age;
	    }
	    
	    void display()
	    {
	    	
	    }

}

class Teacher extends Person implements Serializable {
	protected String department;  //所在系部
	protected String major;  //专业
	protected String title;  //职称

    Teacher(String id, String name, String gender, int age, String department, String major, String title) {
        super(id, name, gender, age);//调用父类构造方法的语句
        //就是为了插入前面的数据, 不调用就不能将信息插入到父类中使用
        this.department = department;
        this.major = major;
        this.title = title;
    }
    
    void display() {  //显示教师信息
        System.out.println("编号:" + id + ",姓名:" + name + ",性别:" + gender + ",年龄:" + age
            + ",所在系部:" + department + ",专业:" + major + ",职称:" + title);
    }

}

class LaboratoryStaff extends Person implements Serializable {
	protected String laboratory;  //所在实验室
	protected String duty;  //职务

    LaboratoryStaff(String id, String name, String gender, int age, String laboratory, String duty) {
        super(id, name, gender, age);
        this.laboratory = laboratory;
        this.duty = duty;
    }
    
    void display() {  //显示实验员信息
        System.out.println("编号:" + id + ",姓名:" + name + ",性别:" + gender + ",年龄:" + age
            + ",所在实验室:" + laboratory + ",职务:" + duty);
    }

    }

class Administrator extends Person implements Serializable  {
	protected String politicalStatus;  //政治面貌
	protected String title;  //职称

    Administrator(String id, String name, String gender, int age, String politicalStatus, String title) {
        super(id, name, gender, age);
        this.politicalStatus = politicalStatus;
        this.title = title;
    }
    
    void display() {  //显示行政人员信息
        System.out.println("编号:" + id + ",姓名:" + name + ",性别:" + gender + ",年龄:" + age
            + ",政治面貌:" + politicalStatus + ",职称:" + title);
    }

    }

class TeacherAdministrator extends Teacher implements Serializable 
{
	protected String politicalStatus;  //政治面貌

    TeacherAdministrator(String id, String name, String gender, int age, String department, String major, String title,String politicalStatus) {
        super(id, name, gender, age,department,major,title);//调用父类构造方法的语句
        //就是为了插入前面的数据, 不调用就不能将信息插入到父类中使用
        this.politicalStatus=politicalStatus;
      
    }
    
	void display() {  //显示教师兼行政人员信息
	    System.out.println("编号:" + id + ",姓名:" + name + ",性别:" + gender + ",年龄:" + age
	        + ",所在系部:" + department + ",专业:" + major + ",职称:" + title + ",政治面貌:" + politicalStatus);
	}

}


class PersonManager//信息管理系统
{
	private static Scanner input=new Scanner(System.in);
	private Person persons[]=new Person[1000];//人的个数
	private int count =0;//记录人的数量,也就是数据个数
	
	
	//用equals语句来判断是否存在重复id
	private boolean idExists(String id)//判断id是否存在的方法
	{
		for(int i=0;i

你可能感兴趣的:(java,前端)