Java實(shí)現(xiàn)高校教務(wù)系統(tǒng)
本文實(shí)例為大家分享了Java實(shí)現(xiàn)高校教務(wù)系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下
需求:建立一個(gè)教務(wù)管理系統(tǒng),為學(xué)生和教師提供不同的功能
//簡(jiǎn)單利用javase基礎(chǔ)做出后端框架,后期再利用mysql數(shù)據(jù)庫(kù)以及Spring cloud完善
父類:
public class people { ? ? ? private String name; ? ? private int age; ? ? private String sex; ? ? ? public people() { ? ? } ? ? public people(String name, int age, String sex) { ? ? ? ? this.name = name; ? ? ? ? this.age = age; ? ? ? ? this.sex = sex; ? ? } ? ? ? public String getName() { ? ? ? ? return name; ? ? } ? ? ? public void setName(String name) { ? ? ? ? this.name = name; ? ? } ? ? ? public int getAge() { ? ? ? ? return age; ? ? } ? ? ? public void setAge(int age) { ? ? ? ? this.age = age; ? ? } ? ? ? public String getSex() { ? ? ? ? return sex; ? ? } ? ? ? public void setSex(String sex) { ? ? ? ? this.sex = sex; ? ? } }
學(xué)生類:
public class student ?extends people{ ? ? ? private String classname; ? ? private String studyid; ? ? ? private String chengji=""; ? ? ? private String kebiao=""; ? ? ? private String jiguo=""; ? ? ? ? private String studypassword; ? ? ? public student() { ? ? } ? ? ? public student(String name, int age, String sex, String classname, String studyid, String studypassword) { ? ? ? ? super(name, age, sex); ? ? ? ? this.classname = classname; ? ? ? ? this.studyid = studyid; ? ? ? ? this.studypassword = studypassword; ? ? } ? ? ? public String getClassname() { ? ? ? ? return classname; ? ? } ? ? ? public void setClassname(String classname) { ? ? ? ? this.classname = classname; ? ? } ? ? ? public String getStudyid() { ? ? ? ? return studyid; ? ? } ? ? ? public void setStudyid(String studyid) { ? ? ? ? this.studyid = studyid; ? ? } ? ? ? public String getStudypassword() { ? ? ? ? return studypassword; ? ? } ? ? ? public void setStudypassword(String studypass) { ? ? ? ? this.studypassword = studypassword; ? ? } ? ? ? public String getChengji() { ? ? ? ? return chengji; ? ? } ? ? ? public void setChengji(String chengji) { ? ? ? ? this.chengji = chengji; ? ? } ? ? ? ? public String getKebiao() { ? ? ? ? return kebiao; ? ? } ? ? ? public void setKebiao(String kebiao) { ? ? ? ? this.kebiao = kebiao; ? ? } ? ? ? public String getJiguo() { ? ? ? ? return jiguo; ? ? } ? ? ? public void setJiguo(String jiguo) { ? ? ? ? this.jiguo = jiguo; ? ? } }
教師類:
public class teacher extends people{ ? ? ? private String teachclass; ? ? private String teachid; ? ? ? private String teachpassword; ? ?? ? ? ? public teacher() { ? ? } ? ? ? public teacher(String name, int age, String sex, String teachclass, String teachid, String teachpassword) { ? ? ? ? super(name, age, sex); ? ? ? ? this.teachclass = teachclass; ? ? ? ? this.teachid = teachid; ? ? ? ? this.teachpassword = teachpassword; ? ? } ? ? ? public String getTeachclass() { ? ? ? ? return teachclass; ? ? } ? ? ? public void setTeachclass(String teachclass) { ? ? ? ? this.teachclass = teachclass; ? ? } ? ? ? public String getTeachid() { ? ? ? ? return teachid; ? ? } ? ? ? public void setTeachid(String teachid) { ? ? ? ? this.teachid = teachid; ? ? } ? ? ? public String getTeachpassword() { ? ? ? ? return teachpassword; ? ? } ? ? ? public void setTeachpassword(String teachpassword) { ? ? ? ? this.teachpassword = teachpassword; ? ? } ? ? ? }
源碼:
import java.util.ArrayList; import java.util.Random; import java.util.Scanner; ? public class test { ? ? ? public static void main(String[] args) ? ? { ? ? ? ? ArrayList<student> students = new ArrayList<>(); ? ? ? ? ArrayList<teacher> teachers = new ArrayList<>(); ? ? ? ? ? ? main(teachers,students); ? ? ? ? ? ? end(); ? ? } ? ? ? public static void main(ArrayList<teacher>teachers,ArrayList<student>students) ? ? { ? ? ? ? Scanner sc = new Scanner(System.in); ? ? ? ? System.out.println("----------歡迎來(lái)到中彬教育后臺(tái)管理系統(tǒng)-----------"); ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("請(qǐng)輸入您的身份:1.老師 ?2.學(xué)生 或者按0退出系統(tǒng)"); ? ? ? ? ? ? int commend = sc.nextInt(); ? ? ? ? ? ? switch (commend) { ? ? ? ? ? ? ? ? case 1: ? ? ? ? ? ? ? ? ? ? teach(students,teachers,sc); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 2: ? ? ? ? ? ? ? ? ? ? student(students,sc); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 0: ? ? ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? ? ? default: ? ? ? ? ? ? ? ? ? ? System.out.println("輸入不合法!請(qǐng)重新輸入,或按0退出"); ? ? ? ? ? ? } ? ? ? ? } ? ? } ? ? public static void teach(ArrayList<student>students,ArrayList<teacher>teachers,Scanner sc) ? ? { ? ? ? ? System.out.println("----------歡迎進(jìn)入教師界面----------"); ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("請(qǐng)選擇您的操作:"); ? ? ? ? ? ? System.out.println("1.教師登錄"); ? ? ? ? ? ? System.out.println("2.教師注冊(cè)"); ? ? ? ? ? ? System.out.println("3.返回"); ? ? ? ? ? ? int commend = sc.nextInt(); ? ? ? ? ? ? switch (commend) { ? ? ? ? ? ? ? ? case 1: ? ? ? ? ? ? ? ? ? ? teacherdenglu(students,teachers,sc); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 2: ? ? ? ? ? ? ? ? ? ? teacherzhuce(teachers,sc); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 3: ? ? ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? ? ? default: ? ? ? ? ? ? ? ? ? ? System.out.println("不存在該功能!"); ? ? ? ? ? ? } ? ? ? ? } ? ? } ? ? public static void student( ArrayList <student> students ,Scanner sc) ? ? { ? ? ? ? System.out.println("----------歡迎進(jìn)入學(xué)生界面----------"); ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("請(qǐng)選擇您的操作:"); ? ? ? ? ? ? System.out.println("1.學(xué)生登錄"); ? ? ? ? ? ? System.out.println("2.學(xué)生注冊(cè)"); ? ? ? ? ? ? System.out.println("3.返回"); ? ? ? ? ? ? int commend = sc.nextInt(); ? ? ? ? ? ? switch (commend) { ? ? ? ? ? ? ? ? case 1: ? ? ? ? ? ? ? ? ? ? studentdenglu(students,sc); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 2: ? ? ? ? ? ? ? ? ? ? studentzhuce(students,sc); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 3: ? ? ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? ? ? default: ? ? ? ? ? ? ? ? ? ? System.out.println("不存在該功能!"); ? ? ? ? ? ? } ? ? ? ? } ? ? } ? ? public static void studentdenglu(ArrayList<student>students,Scanner sc) ? ? { ? ? ? ? System.out.println("----------歡迎進(jìn)入學(xué)生登錄系統(tǒng)----------"); ? ? ? ? String studyid; ? ? ? ? String password; ? ? ? ? String code; ? ? ? ? String code2 =yanzhengma(); ? ? ? ? if(students.size()==0) ? ? ? ? { ? ? ? ? ? ? System.out.println("系統(tǒng)中無(wú)學(xué)生信息!,請(qǐng)先注冊(cè)學(xué)生賬戶"); ? ? ? ? } ? ? ? ? else ? ? ? ? { ? ? ? ? ? ? while (true) { ? ? ? ? ? ? ? ? System.out.println("請(qǐng)輸入學(xué)號(hào):"); ? ? ? ? ? ? ? ? studyid = sc.next(); ? ? ? ? ? ? ? ? student acc =getstudyid(studyid,students); ? ? ? ? ? ? ? ? if(acc!=null) ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? System.out.println("請(qǐng)輸入密碼:"); ? ? ? ? ? ? ? ? ? ? password= sc.next(); ? ? ? ? ? ? ? ? ? ? if(password.equals(acc.getStudypassword())) ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("請(qǐng)輸入驗(yàn)證碼"); ? ? ? ? ? ? ? ? ? ? ? ? System.out.println(code2); ? ? ? ? ? ? ? ? ? ? ? ? code= sc.next(); ? ? ? ? ? ? ? ? ? ? ? ? if(code.equals(code2)) ? ? ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("登錄成功!,進(jìn)入學(xué)生"+acc.getName()+"的主頁(yè)"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? studentmain(students,sc,acc); ? ? ? ? ? ? ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? else ? ? ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("驗(yàn)證碼輸入錯(cuò)誤!"); ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? else ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("密碼錯(cuò)誤!"); ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? else ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? System.out.println("不存在該學(xué)號(hào)!"); ? ? ? ? ? ? ? ? } ? ? ? ? ? ? } ? ? ? ? } ? ? } ? ? ? public static void studentmain(ArrayList<student>students,Scanner sc,student s) ? ? { ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("----------學(xué)生"+s.getName()+"的主頁(yè)----------"); ? ? ? ? ? ? System.out.println("選擇操作:"); ? ? ? ? ? ? System.out.println("1.查詢基本信息"); ? ? ? ? ? ? System.out.println("2.查詢成績(jī)"); ? ? ? ? ? ? System.out.println("3.查詢課表"); ? ? ? ? ? ? System.out.println("4.查詢記過(guò)"); ? ? ? ? ? ? System.out.println("5.注銷"); ? ? ? ? ? ? System.out.println("6.退出系統(tǒng)"); ? ? ? ? ? ? System.out.println("7.修改密碼"); ? ? ? ? ? ? int commend= sc.nextInt(); ? ? ? ? ? ? switch (commend) ? ? ? ? ? ? { ? ? ? ? ? ? ? ? case 1: ? ? ? ? ? ? ? ? ? ? student1(students,s); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 2: ? ? ? ? ? ? ? ? ? ? student2(students,s); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 3: ? ? ? ? ? ? ? ? ? ? student3(students,s,sc); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 4: ? ? ? ? ? ? ? ? ? ? student4(students,s); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 5: ? ? ? ? ? ? ? ? ? ? over(sc,students,s); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 6: ? ? ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? ? ? case 7: ? ? ? ? ? ? ? ? ? ? xiugai(students,s,sc); ? ? ? ? ? ? ? ? default: ? ? ? ? ? ? ? ? ? ? System.out.println("不存在該功能!"); ? ? ? ? ? ? } ? ? ? ? } ? ? } ? ? ? public static void teachmain(ArrayList<student>students,ArrayList<teacher>teachers,Scanner sc ,teacher t) ? ? { ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("----------教師"+t.getName()+"的主頁(yè)-----------"); ? ? ? ? ? ? System.out.println("選擇操作:"); ? ? ? ? ? ? System.out.println("1.基本信息"); ? ? ? ? ? ? System.out.println("2.教學(xué)課程"); ? ? ? ? ? ? System.out.println("3.添加成績(jī)"); ? ? ? ? ? ? System.out.println("4.添加課表"); ? ? ? ? ? ? System.out.println("5.添加記過(guò)"); ? ? ? ? ? ? System.out.println("6.注銷"); ? ? ? ? ? ? System.out.println("7.退出系統(tǒng)"); ? ? ? ? ? ? System.out.println("8.修改密碼"); ? ? ? ? ? ? int commend = sc.nextInt(); ? ? ? ? ? ? switch (commend) ? ? ? ? ? ? { ? ? ? ? ? ? ? ? case 1: ? ? ? ? ? ? ? ? ? ? teach1(teachers,t); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 2: ? ? ? ? ? ? ? ? ? ? teach2(teachers,t,sc); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 3: ? ? ? ? ? ? ? ? ? ? teach3(students,sc); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 4: ? ? ? ? ? ? ? ? ? ? teach4(students,sc); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 5: ? ? ? ? ? ? ? ? ? ? teach5(students,sc); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 6: ? ? ? ? ? ? ? ? ? ? over2(sc,teachers,t); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? case 7: ? ? ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? ? ? case 8: ? ? ? ? ? ? ? ? ? ? xiugai2(teachers,t,sc); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? default: ? ? ? ? ? ? ? ? ? ? System.out.println("功能不存在!"); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? } ? ? ? ? } ? ? } ? ? ? ? public static void studentzhuce(ArrayList<student>students,Scanner sc) { ? ? ? ? System.out.println("----------歡迎進(jìn)入學(xué)生注冊(cè)系統(tǒng)----------"); ? ? ? ? System.out.println("請(qǐng)輸入您的姓名:"); ? ? ? ? String name = sc.next(); ? ? ? ? System.out.println("請(qǐng)輸入年齡:"); ? ? ? ? int age = sc.nextInt(); ? ? ? ? String sex; ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("請(qǐng)輸入性別:"); ? ? ? ? ? ? sex = sc.next(); ? ? ? ? ? ? if (sex.equals("男") || sex.equals("女")) { ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? } else System.out.println("性別輸入不合法!請(qǐng)重新輸入"); ? ? ? ? } ? ? ? ? System.out.println("請(qǐng)輸入班級(jí)名:"); ? ? ? ? String classname = sc.next(); ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("請(qǐng)輸入學(xué)號(hào):"); ? ? ? ? ? ? String studyid = sc.next(); ? ? ? ? ? ? String password; ? ? ? ? ? ? while (true) { ? ? ? ? ? ? ? ? System.out.println("請(qǐng)輸入密碼:"); ? ? ? ? ? ? ? ? password = sc.next(); ? ? ? ? ? ? ? ? System.out.println("請(qǐng)?jiān)俅屋斎朊艽a:"); ? ? ? ? ? ? ? ? String password2 = sc.next(); ? ? ? ? ? ? ? ? if (password.equals(password2)) { ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? else { ? ? ? ? ? ? ? ? ? ? System.out.println("兩次輸入密碼不一致!請(qǐng)重新輸入!"); ? ? ? ? ? ? ? ? } ? ? ? ? ? ? } ? ? ? ? ? ? student s = new student(name, age, sex, classname, studyid, password); ? ? ? ? ? ? System.out.println("您的信息如下:"); ? ? ? ? ? ? System.out.println(classname + "\t\t\t" + studyid + "\t\t\t" + name + "\t\t\t" + age + "\t\t\t" + sex); ? ? ? ? ? ? students.add(s); ? ? ? ? ? ? break; ? ? ? ? } } ? ? ? ? ? private static void teacherdenglu(ArrayList<student>students,ArrayList<teacher>teachers,Scanner sc) ? ? { ? ? ? ? System.out.println("----------歡迎進(jìn)入教師登錄系統(tǒng)----------"); ? ? ? ? String teachid; ? ? ? ? String password; ? ? ? ? String code; ? ? ? ? String code2 =yanzhengma(); ? ? ? ? if(teachers.size()==0) ? ? ? ? { ? ? ? ? ? ? System.out.println("系統(tǒng)中無(wú)教師信息!,請(qǐng)先注冊(cè)賬戶"); ? ? ? ? } ? ? ? ? else ? ? ? ? { ? ? ? ? ? ? while (true) { ? ? ? ? ? ? ? ? System.out.println("請(qǐng)輸入職工號(hào):"); ? ? ? ? ? ? ? ? teachid = sc.next(); ? ? ? ? ? ? ? ? teacher acc =getteachid(teachid,teachers); ? ? ? ? ? ? ? ? if(acc!=null) ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? System.out.println("請(qǐng)輸入密碼:"); ? ? ? ? ? ? ? ? ? ? password= sc.next(); ? ? ? ? ? ? ? ? ? ? if(password.equals(acc.getTeachpassword())) ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("請(qǐng)輸入驗(yàn)證碼"); ? ? ? ? ? ? ? ? ? ? ? ? System.out.println(code2); ? ? ? ? ? ? ? ? ? ? ? ? code= sc.next(); ? ? ? ? ? ? ? ? ? ? ? ? if(code.equals(code2)) ? ? ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("登錄成功!,進(jìn)入教師"+acc.getName()+"的主頁(yè)"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? teachmain(students,teachers,sc,acc); ? ? ? ? ? ? ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? else ? ? ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("驗(yàn)證碼輸入錯(cuò)誤!"); ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? else ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("密碼錯(cuò)誤!"); ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? else ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? System.out.println("不存在該職工號(hào)!"); ? ? ? ? ? ? ? ? } ? ? ? ? ? ? } ? ? ? ? } ? ? } ? ? private static void teacherzhuce(ArrayList<teacher>teachers,Scanner sc) { ? ? ? ? System.out.println("----------歡迎進(jìn)入教師注冊(cè)系統(tǒng)----------"); ? ? ? ? System.out.println("請(qǐng)輸入您的姓名:"); ? ? ? ? String name = sc.next(); ? ? ? ? System.out.println("請(qǐng)輸入年齡:"); ? ? ? ? int age = sc.nextInt(); ? ? ? ? String sex; ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("請(qǐng)輸入性別:"); ? ? ? ? ? ? sex = sc.next(); ? ? ? ? ? ? if (sex.equals("男") || sex.equals("女")) { ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? } else System.out.println("性別輸入不合法!請(qǐng)重新輸入"); ? ? ? ? } ? ? ? ? System.out.println("請(qǐng)輸入教學(xué)班級(jí)名:"); ? ? ? ? String teacherclass = sc.next(); ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("請(qǐng)輸入職工號(hào):"); ? ? ? ? ? ? String teachid = sc.next(); ? ? ? ? ? ? ? ? ? ? String password; ? ? ? ? ? ? ? ? ? ? while (true) { ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("請(qǐng)輸入密碼:"); ? ? ? ? ? ? ? ? ? ? ? ? password = sc.next(); ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("請(qǐng)?jiān)俅屋斎朊艽a:"); ? ? ? ? ? ? ? ? ? ? ? ? String password2 = sc.next(); ? ? ? ? ? ? ? ? ? ? ? ? if (password.equals(password2)) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? } else { ? ? ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("兩次輸入密碼不一致!請(qǐng)重新輸入!"); ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? teacher s = new teacher(name, age, sex, teacherclass, teachid, password); ? ? ? ? ? ? ? ? ? ? System.out.println("您的信息如下:"); ? ? ? ? ? ? ? ? ? ? System.out.println(teacherclass + "\t\t\t" + teachid + "\t\t\t" + name + "\t\t\t" + age + "\t\t\t" + sex); ? ? ? ? ? ? ? ? ? ? teachers.add(s); ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? } ? ? ? ? } ? ? ? ? public static void student1(ArrayList<student>students,student s) ? ? ? ? { ? ? ? ? ? ? System.out.println("----------基本信息----------"); ? ? ? ? ? ? System.out.println("學(xué)生姓名:"+s.getName()); ? ? ? ? ? ? System.out.println("學(xué)生班級(jí):"+s.getClassname()); ? ? ? ? ? ? System.out.println("學(xué)生學(xué)號(hào):"+s.getStudyid()); ? ? ? ? ? ? System.out.println("學(xué)生年齡:"+s.getAge()); ? ? ? ? ? ? System.out.println("學(xué)生性別:"+s.getSex()); ? ? ? ? } ? ? ? ? public static void student2(ArrayList<student>students,student s) ? ? ? ? { ? ? ? ? ? ? System.out.println("學(xué)生"+s.getName()+"的成績(jī)查詢"); ? ? ? ? ? ? System.out.println("科目"+"\t\t\t"+"成績(jī)"+"\t\t\t"+"績(jī)點(diǎn)"); ? ? ? ? ? ? System.out.println(s.getChengji()); ? ? ? ? ? } ? ? ? ? public static void student3(ArrayList<student>students,student s,Scanner sc) ? ? ? ? { ? ? ? ? ? ? System.out.println("課表查詢:"); ? ? ? ? ? ? System.out.println("班級(jí)"+s.getClassname()+"的"+"課表為"); ? ? ? ? ? ? System.out.println(s.getKebiao()); ? ? ? ? } ? ? ? ? public static void student4(ArrayList<student>students,student s) ? ? ? ? { ? ? ? ? ? ? System.out.println("----------記過(guò)查詢----------"); ? ? ? ? ? ? System.out.println(s.getName()+"的記過(guò)為"+s.getJiguo()+"\n"); ? ? ? ? } ? ? ? ? ? public static void over(Scanner sc,ArrayList<student>students,student s) ? ? ? ? { ? ? ? ? ? ? System.out.println("是否確認(rèn)注銷賬戶?按1確認(rèn),按2取消注銷"); ? ? ? ? ? ? int tf = sc.nextInt(); ? ? ? ? ? ? if (tf == 1) { ? ? ? ? ? ? ? ? students.remove(s); ? ? ? ? ? ? ? ? System.out.println("注銷成功!"); ? ? ? ? ? ? } else ? ? ? ? ? ? { ? ? ? ? ? ? ? ? System.out.println("取消注銷"); ? ? ? ? ? ? } ? ? ? ? } ? ? ? public static void over2(Scanner sc,ArrayList<teacher>teachers,teacher s) ? ? { ? ? ? ? System.out.println("是否確認(rèn)注銷賬戶?按1確認(rèn),按2取消注銷"); ? ? ? ? int tf = sc.nextInt(); ? ? ? ? if (tf == 1) { ? ? ? ? ? ? teachers.remove(s); ? ? ? ? ? ? System.out.println("注銷成功!"); ? ? ? ? } else ? ? ? ? { ? ? ? ? ? ? System.out.println("取消注銷"); ? ? ? ? } ? ? } ? ? ? ? ? public static void teach1(ArrayList<teacher>teachers,teacher s) ? ? { ? ? ? ? System.out.println("----------基本信息----------"); ? ? ? ? System.out.println("教師名稱:"+s.getName()); ? ? ? ? System.out.println("教師年齡:"+s.getAge()); ? ? ? ? System.out.println("教師性別:"+s.getSex()); ? ? ? ? System.out.println("教師職工號(hào):"+s.getTeachid()); ? ? ? ? System.out.println("教師教學(xué)班級(jí):"+s.getTeachclass()); ? ? } ? ? public static void teach2(ArrayList<teacher>teachers,teacher s,Scanner sc) ? ? ? { ? ? ? ? System.out.println("----------教學(xué)課程----------"); ? ? ? ? System.out.println(s.getTeachclass()); ? ? ? ? System.out.println("添加請(qǐng)按1,修改請(qǐng)按2,退出按0"); ? ? ? ? int commend = sc.nextInt(); ? ? ? ? switch (commend) ? ? ? ? { ? ? ? ? ? ? case 1: ? ? ? ? ? ? ? ? System.out.println("輸入要添加的課程:"); ? ? ? ? ? ? ? ? String addclass = sc.next(); ? ? ? ? ? ? ? ? s.setTeachclass(addclass+","+s.getTeachclass()); ? ? ? ? ? ? ? ? System.out.println("修改成功!新課程是"+s.getTeachclass()); ? ? ? ? ? ? break; ? ? ? ? ? ? case 2: ? ? ? ? ? ? ? ? System.out.println("輸入要修改后的課程:"); ? ? ? ? ? ? ? ? String newclass =sc.next(); ? ? ? ? ? ? ? ? s.setTeachclass(newclass); ? ? ? ? ? ? ? ? System.out.println("修改成功!新課程是"+s.getTeachclass()); ? ? ? ? ? ? break; ? ? ? ? ? ? case 0: ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? default: ? ? ? ? ? ? ? ? System.out.println("功能不存在!"); ? ? ? ? } ? ? } ? ? public static void teach3(ArrayList<student>students,Scanner sc) { ? ? ? ? ? ? ? System.out.println("----------添加成績(jī)----------"); ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("請(qǐng)輸入學(xué)生學(xué)號(hào):"); ? ? ? ? ? ? String tostudyid = sc.next(); ? ? ? ? ? ? student tf = getstudyid(tostudyid, students); ? ? ? ? ? ? if (tf != null) { ? ? ? ? ? ? ? ? for (int i = 0; i < students.size(); i++) { ? ? ? ? ? ? ? ? ? ? student c = students.get(i); ? ? ? ? ? ? ? ? ? ? if (c.getStudyid().equals(tostudyid)) { ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("輸入課程名稱:"); ? ? ? ? ? ? ? ? ? ? ? ? String kecheng = sc.next(); ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("輸入成績(jī):"); ? ? ? ? ? ? ? ? ? ? ? ? double score = sc.nextDouble(); ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("輸入績(jī)點(diǎn):"); ? ? ? ? ? ? ? ? ? ? ? ? double jidian =sc.nextDouble(); ? ? ? ? ? ? ? ? ? ? ? ? String chengji=kecheng+"\t\t\t"+score+"\t\t\t"+jidian; ? ? ? ? ? ? ? ? ? ? ? ? c.setChengji(c.getChengji()+"\n"+chengji); ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("添加成功!"); ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("繼續(xù)添加按1,退出添加按0"); ? ? ? ? ? ? ? ? ? ? ? ? int commend=sc.nextInt(); ? ? ? ? ? ? ? ? ? ? ? ? switch (commend) ? ? ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? case 1: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? ? ? case 0: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? } ? ? ? ? ? ? } ? ? ? ? ? ? ? else ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? System.out.println("學(xué)生不存在!"); ? ? ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? ? ? } ? ? ? ? } ? ? } ? ? ? public static void teach4(ArrayList<student>students,Scanner sc) ? ? { ? ? ? ? System.out.println("----------添加課表----------"); ? ? ? ? System.out.println("請(qǐng)輸入班級(jí)名稱:"); ? ? ? ? String banji= sc.next(); ? ? ? ? student acc=getclass(banji,students); ? ? ? ? if(acc!=null) ? ? ? ? { ? ? ? ? ? ? System.out.println("請(qǐng)輸入年級(jí):1.大一上 2.大一下 3.大二上 4.大二下 ?5.大三上 ?6.大三下"); ? ? ? ? ? ? String commend=sc.next(); ? ? ? ? ? ? System.out.println("班級(jí)"+acc.getClassname()+"的"+commend+"課表為"); ? ? ? ? ? ? teachtuo(students,acc,sc); ? ? ? ? } ? ? ? ? else ? ? ? ? ? ? System.out.println("班級(jí)不存在!"); ? ? } ? ? public static void teachtuo(ArrayList<student>students,student s ,Scanner sc) ? ? { ? ? ? ? System.out.println("請(qǐng)輸入星期:1,2,3,4,5"); ? ? ? ? int commend = sc.nextInt(); ? ? ? ? System.out.println("請(qǐng)輸入1-2節(jié):"); ? ? ? ? String sub12 = sc.next(); ? ? ? ? System.out.println("請(qǐng)輸入3-4節(jié):"); ? ? ? ? String sub34= sc.next(); ? ? ? ? System.out.println("請(qǐng)輸入5-6節(jié):"); ? ? ? ? String sub56=sc.next(); ? ? ? ? System.out.println("請(qǐng)輸入7-8節(jié):"); ? ? ? ? String sub78=sc.next(); ? ? ? ? String newkebiao ="星期"+commend+":\t\t"+sub12+"\t\t"+sub34+"\t\t"+sub56+"\t\t"+sub78; ? ? ? ? s.setKebiao(newkebiao+s.getKebiao()); ? ? } ? ? ? public static void teach5(ArrayList<student>students,Scanner sc) ? ? { ? ? ? ? System.out.println("----------添加記過(guò)----------"); ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("請(qǐng)輸入學(xué)生學(xué)號(hào):"); ? ? ? ? ? ? String tostudyid = sc.next(); ? ? ? ? ? ? student tf = getstudyid(tostudyid, students); ? ? ? ? ? ? if (tf != null) { ? ? ? ? ? ? ? ? for (int i = 0; i < students.size(); i++) { ? ? ? ? ? ? ? ? ? ? student c = students.get(i); ? ? ? ? ? ? ? ? ? ? if (c.getStudyid().equals(tostudyid)) { ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("輸入記過(guò):"); ? ? ? ? ? ? ? ? ? ? ? ? String ji = sc.next(); ? ? ? ? ? ? ? ? ? ? ? ? c.setJiguo(tf.getJiguo()+ji); ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("添加成功!"); ? ? ? ? ? ? ? ? ? ? ? ? System.out.println("繼續(xù)添加按1,退出添加按0"); ? ? ? ? ? ? ? ? ? ? ? ? int commend=sc.nextInt(); ? ? ? ? ? ? ? ? ? ? ? ? switch (commend) ? ? ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? case 1: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? ? ? case 0: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? } ? ? ? ? ? ? } ? ? ? ? ? ? else ? ? ? ? ? ? { ? ? ? ? ? ? ? ? System.out.println("學(xué)生不存在!"); ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? } ? ? ? ? } ? ? } ? ? ? ? ? ? private static String yanzhengma() ? ? { ? ? ? ? Random r = new Random(); ? ? ? ? String ku ="0123456789"; ? ? ? ? String code=""; ? ? ? ? for (int i = 0; i < 4; i++) ? ? ? ? { ? ? ? ? ? ? int index = r.nextInt(ku.length()); ? ? ? ? ? ? char c = ku.charAt(index); ? ? ? ? ? ? code+=c; ? ? ? ? } ? ? ? ? return code; ? ? } ? ? ? //查詢班級(jí)是否存在 ? ? public static student getclass(String classname,ArrayList<student>students) ? ? { ? ? ? ? for (int i = 0; i < students.size(); i++) { ? ? ? ? ? ? student s =students.get(i); ? ? ? ? ? ? if(s.getClassname().equals(classname)) ? ? ? ? ? ? { ? ? ? ? ? ? ? ? return s; ? ? ? ? ? ? } ? ? ? ? } ? ? ? ? return null; ? ? } ? ? ? //查詢學(xué)生賬戶是否存在 ? ? private static student getstudyid(String studyid,ArrayList<student>students) ? ? { ? ? ? ? for (int i = 0; i < students.size(); i++) { ? ? ? ? ? ? student s = students.get(i); ? ? ? ? ? ? if (s.getStudyid().equals(studyid)) { ? ? ? ? ? ? ? ? return s; ? ? ? ? ? ? } ? ? ? ? } ? ? ? ? ? ? ? ? return null; ? ? } ? ? //查詢教師賬戶是否存在 ? ? public static teacher getteachid(String teachid,ArrayList<teacher>teachers) ? ? { ? ? ? ? for (int i = 0; i < teachers.size(); i++) ? ? ? ? { ? ? ? ? ? ? teacher s =teachers.get(i); ? ? ? ? ? ? if(s.getTeachid().equals(teachid)) ? ? ? ? ? ? { ? ? ? ? ? ? ? ? return s; ? ? ? ? ? ? } ? ? ? ? } ? ? ? ? return null; ? ? } ? ? ? public static void xiugai(ArrayList<student>students , student s,Scanner sc) { ? ? ? ? System.out.println("修改密碼操作"); ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("請(qǐng)輸入原密碼"); ? ? ? ? ? ? String oldpassword = sc.next(); ? ? ? ? ? ? if (oldpassword.equals(s.getStudypassword())) { ? ? ? ? ? ? ? ? ? System.out.println("請(qǐng)輸入新密碼:"); ? ? ? ? ? ? ? ? String newpassword= sc.next(); ? ? ? ? ? ? ? ? System.out.println("請(qǐng)?jiān)俅屋斎胄旅艽a:"); ? ? ? ? ? ? ? ? String newpassword2= sc.next(); ? ? ? ? ? ? ? ? if(newpassword.equals(newpassword2)) ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? System.out.println("修改成功!"); ? ? ? ? ? ? ? ? ? ? s.setStudypassword(newpassword); ? ? ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? else ? ? ? ? ? ? ? ? ? ? System.out.println("兩次密碼不一致!請(qǐng)重新修改!"); ? ? ? ? ? ? } ? ? ? ? ? ? else { ? ? ? ? ? ? ? ? System.out.println("原密碼錯(cuò)誤!"); ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? } ? ? ? ? } ? ? } ? ? ? ? public static void xiugai2(ArrayList<teacher>teachers , teacher s,Scanner sc) { ? ? ? ? System.out.println("修改密碼操作"); ? ? ? ? while (true) { ? ? ? ? ? ? System.out.println("請(qǐng)輸入原密碼"); ? ? ? ? ? ? String oldpassword = sc.next(); ? ? ? ? ? ? if (oldpassword.equals(s.getTeachpassword())) { ? ? ? ? ? ? ? ? ? System.out.println("請(qǐng)輸入新密碼:"); ? ? ? ? ? ? ? ? String newpassword= sc.next(); ? ? ? ? ? ? ? ? System.out.println("請(qǐng)?jiān)俅屋斎胄旅艽a:"); ? ? ? ? ? ? ? ? String newpassword2= sc.next(); ? ? ? ? ? ? ? ? if(newpassword.equals(newpassword2)) ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? System.out.println("修改成功!"); ? ? ? ? ? ? ? ? ? ? s.setTeachpassword(newpassword); ? ? ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? else ? ? ? ? ? ? ? ? ? ? System.out.println("兩次密碼不一致!請(qǐng)重新修改!"); ? ? ? ? ? ? } ? ? ? ? ? ? else { ? ? ? ? ? ? ? ? System.out.println("原密碼錯(cuò)誤!"); ? ? ? ? ? ? ? ? return; ? ? ? ? ? ? } ? ? ? ? } ? ? } ? ? public static void end() ? ? { ? ? ? ? System.out.println("已退出系統(tǒng)!歡迎下次進(jìn)入"); ? ? } }
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
簡(jiǎn)單談?wù)凷truts動(dòng)態(tài)表單(DynamicForm)
下面小編就為大家?guī)?lái)一篇簡(jiǎn)單談?wù)凷truts動(dòng)態(tài)表單(DynamicForm)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-08-08Java實(shí)現(xiàn)簡(jiǎn)單抽獎(jiǎng)功能界面
這篇文章主要為大家詳細(xì)介紹了Java實(shí)現(xiàn)簡(jiǎn)單抽獎(jiǎng)功能界面,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-11-11IntelliJ?IDEA?2020.2.3永久破解激活教程(親測(cè)有效)
intellij?idea?2022是一款市面上最好的JAVA?IDE編程工具,該工具支持git、svn、github等版本控制工具,整合了智能代碼助手、代碼自動(dòng)提示等功能,本教程給大家分享IDEA?2022最新永久激活碼,感興趣的朋友參考下吧2020-10-10mybatisplus中EntityWrapper的常用方法
這篇文章主要介紹了mybatisplus中EntityWrapper的常用方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-03-03Java開(kāi)發(fā)環(huán)境配置JDK超詳細(xì)整理(適合新手入門)
這篇文章主要給大家介紹了關(guān)于Java開(kāi)發(fā)環(huán)境配置JDK超詳細(xì)整理的相關(guān)資料,非常適合新手入門,JDK是Java語(yǔ)言的軟件開(kāi)發(fā)工具包,主要用于移動(dòng)設(shè)備、嵌入式設(shè)備上的java應(yīng)用程序,需要的朋友可以參考下2023-11-11使用javassist動(dòng)態(tài)生成類的配置代碼
Javassist它是一個(gè)用 Java 編輯字節(jié)碼的類庫(kù),它使 Java 程序能夠在運(yùn)行時(shí)定義新類,并在 JVM 加載時(shí)修改類文件,本文給大家介紹使用javassist動(dòng)態(tài)生成類的實(shí)例代碼,感興趣的朋友一起看看吧2022-09-09