日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

【JAVA】学生信息管理系统

發布時間:2023/12/9 windows 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【JAVA】学生信息管理系统 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

目錄

前言

一、環境搭建

二、功能實現

1.學生信息類的創建

2.學生信息的添加功能

3.學生信息的刪除功能

4.學生信息的修改功能?

5.學生信息的查看功能

?三、主類的調用

1.界面的搭建

2.學生端和教師端

3.系統和功能的選擇

總結? ? ? ?


前言

JAVA實現的學生信息管理系統(包含教師端和學生端)

教師端有登錄過程,功能包括對學生信息的增刪改查

學生端無登錄過程,功能只包括查看信息


一、環境搭建

  • 在idea創建一個工程文件,在工程文件下創建一個model模塊,在model模塊下載創建三個package包分別用來存放(Management)管理信息包、(function)功能包、(information)學生信息對象類,再在三個包中創建如下圖所示文件
  • 容器選擇:因為本次使用的是自己創建的Student類并且信息數量不確定,所以選擇集合作為Student類的容器
  • 二、功能實現

    1.學生信息類的創建

    ? ? ? ?為了防止屬性不能被外類隨意訪問,因此采用private對學生類中的屬性進行修飾并且進行創建set、get方法以便于調用屬性,再創建打印數據方法,方便數據打印,代碼如下:

    public class Student {private String id;private String name;private String college;private String major;public Student() {}public Student(String id, String name, String college, String major) {this.id = id;this.name = name;this.college = college;this.major = major;}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 getCollege() {return college;}public void setCollege(String college) {this.college = college;}public String getMajor() {return major;}public void setMajor(String major) {this.major = major;}public void information_printf() {System.out.printf("%-16s%-13s" + "\t" + "%-12s" + "\t" + "%s\n", getId(), getName(), getCollege(), getMajor());} }

    2.學生信息的添加功能

    ? ? ? ?在Addtion添加類中,先創建集合容器用來存放數據,并且鍵盤錄入的數據(使用Scanner()方法),再進行對輸入的判斷是否合法,最后將錄入的數據存入集合中,具體實現方法如下:

    public Student Add_information(ArrayList<Student> newList) {Scanner sc = new Scanner(System.in);Student stu = new Student();System.out.println("請輸入學生學號:");//學生學號信息輸入檢查add_check_id(newList, sc, stu);System.out.println("請輸入學生姓名:");String name = sc.next();stu.setName(name);System.out.println("請輸入學生所在學院(4-6字):");//學生學院信息輸入檢查add_check_college(sc, stu);//學生專業班級信息輸入檢查System.out.println("請輸入學生專業班級(4-8字):");add_check_major(sc, stu);return stu;}

    實現效果如圖:

    3.學生信息的刪除功能

    ? ? ? ?在Delete刪除類中,先創建集合容器用來存放數據,并且鍵盤錄入的數據(使用Scanner()方法),再進行信息的判斷是否存在,最后將需要刪除的信息從集合中刪除,具體實現方法如下:

    public ArrayList<Student> Delete_information(ArrayList<Student> newList) {Scanner sc = new Scanner(System.in);System.out.println("請輸入要刪除的學生的學號:");while (true) {String id = sc.next();if (getList_id(newList, id)) {System.out.println("學生信息刪除成功!");break;}System.out.println("該學生信息不存在,請重新輸入:");}return newList;}

    ?實現效果如圖:

    4.學生信息的修改功能?

    ? ? ? ?在Modify修改類中,先創建集合容器用來存放數據,并且鍵盤錄入的數據(使用Scanner()方法),再進行信息的判斷是否存在,再將新錄入的數據代替之前的數據,最后將新的數據重新添加至集合中,具體實現方法如下:

    public ArrayList<Student> Modify_information(ArrayList<Student> newList) {Scanner sc = new Scanner(System.in);System.out.println("請輸入要修改的學生的學號:");while (true) {String id = sc.next();if (getList_id(newList, id)) {System.out.println("學生信息修改成功!");break;}System.out.println("該學生信息不存在,請重新輸入:");}return newList;}

    ?實現效果如圖:

    5.學生信息的查看功能

    ? ? ? ?在View查看類中,先創建集合容器用來存放數據,利用for循環對集合遍歷并且調用Student類中的information_printf()方法打印出所有學生信息,具體實現方法如下:

    public void View_information(ArrayList<Student> newList) {for (int i = 0; i < newList.size(); i++) {Student s = newList.get(i);s.information_printf();}}

    ?實現效果如圖:

    ?三、主類的調用

    1.界面的搭建

    使用System.out.println()方法輸出界面,具體實現方法如下:

    //選擇登錄系統界面 System.out.println("----------學生信息管理系統----------"); System.out.println("* 1、學生登錄 2、教師登錄 3、退出 *"); System.out.println("---------------------------------");//學生端界面 System.out.println("----------學生信息管理系統----------"); System.out.println("* 1、查看信息 2、返回 *"); System.out.println("---------------------------------");//教師登錄界面 System.out.println("----------學生信息管理系統----------"); System.out.println("*1、添加信息 2、刪除信息 3、修改信息*"); System.out.println("*4、查看信息 5、返回 *"); System.out.println("---------------------------------");

    2.學生端和教師端

    ? ? ? ?學生端只能查看學生信息,教師端可以對信息進行增加、刪除、修改、查看四個功能,并且登錄教師端需要輸入用戶名和密碼;先使用Scanner()方法在控制臺接收用戶鍵盤錄入的數據,再將輸入的數據通過對字符串的判斷實現是否登陸成功。具體實現方法如下:

    //教師端登錄 public static void Login_teacher(ArrayList<Student> list) {Scanner sc1 = new Scanner(System.in);Scanner sc2 = new Scanner(System.in);//已知用戶名密碼String name = "Login";String password = "123456";//獲取用戶名密碼while (true) {System.out.println("請輸入用戶名:");String username = sc1.next();System.out.println("請輸入密碼:");String user_password = sc2.next();if (name.equals(username) && password.equals(user_password)) {System.out.println("登陸成功");Management_teacher(list);break;} else {System.out.println("用戶名或密碼錯誤,請重新輸入:");}}}

    ?實現效果如圖:

    ? ?

    3.系統和功能的選擇

    ? ? ? ?先使用Scanner()方法在控制臺接收用戶鍵盤錄入的數據,再將輸入的數據,通過switch(int flag) case :方法進行判斷選擇對應的系統或對應的功能,具體實現方法如下圖:

    //登陸系統選擇 Scanner sc = new Scanner(System.in);wc:while (true) {System.out.println("----------學生信息管理系統----------");System.out.println("* 1、學生登錄 2、教師登錄 3、退出 *");System.out.println("---------------------------------");int flag = sc.nextInt();switch (flag) {case 1:Management_student(list);break;case 2:Login_teacher(list);break;case 3:break wc;default:System.out.println("輸入有誤,請重新輸入:");break;}}//學生功能選擇 Scanner sc = new Scanner(System.in);wc2:while (true) {System.out.println("----------學生信息管理系統----------");System.out.println("* 1、查看信息 2、返回 *");System.out.println("---------------------------------");int flags = sc.nextInt();switch (flags) {case 1:view_Student_information(list);break;case 2:break wc2;}}//教師端功能選擇 Scanner sc = new Scanner(System.in);wc:while (true) {System.out.println("----------學生信息管理系統----------");System.out.println("*1、添加信息 2、刪除信息 3、修改信息*");System.out.println("*4、查看信息 5、返回 *");System.out.println("---------------------------------");int flag = sc.nextInt();switch (flag) {case 1://學生信息的添加add_Student_information(list);break;case 2://學生信息的刪除delete_Student_information(list);break;case 3://學生信息的修改modify_Student_information(list);break;case 4://學生信息的查詢view_Student_information(list);break;case 5:break wc;default:System.out.println("輸入有誤,請重新輸入:");break;}}

    總結? ? ? ?

    ? ? ? ?以上就是我實現學生信息管理系統的方案,本文僅僅介紹了實現方案及制作流程,僅供參考,若有問題請幫忙留言指出,歡迎交流學習。

    需要所有源文件可以下載

    JAVA實現的學生信息管理系統-Java文檔類資源-CSDN文庫https://download.csdn.net/download/huihu__/85208959

    總結

    以上是生活随笔為你收集整理的【JAVA】学生信息管理系统的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。