Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use Java to realize Student Information Management system

Shulou Source: shulou.com Published: 2022-06-03 14:14:47 09月23日 Update

This article mainly shows you "how to use Java to achieve student information management system", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use Java to achieve student information management system" this article.

Student.java:

Package com.mumu;public class Student {/ / defines the student class private String name; private String age; private String id; private String room_num; private int math; private int english; private int physic; public Student () {/ / No-parameter construction method} public Student (String name, String age, String id, String room_num, int math, int english, int physic) {this.name = name; this.age = age This.id = id; this.room_num = room_num; this.math = math; this.english = english; this.physic = physic;} / / Alt+ insert key, which automatically generates the constructor public String getName () {return name;} public void setName (String name) {this.name = name;} public String getAge () {return age } public void setAge (String age) {this.age = age;} public String getId () {return id;} public void setId (String id) {this.id = id;} public String getRoom_num () {return room_num;} public void setRoom_num (String room_num) {this.room_num = room_num } public int getMath () {return math;} public int getEnglish () {return english;} public int getPhysic () {return physic;} public void setMath (int math) {this.math = math;} public void setEnglish (int english) {this.english = english;} public void setPhysic (int physic) {this.physic = physic }}

StudentManager .java:

Package com.mumu;import java.util.ArrayList;import java.util.Scanner;public class StudentManager {public static void main (String [] args) {ArrayList array=new ArrayList (); menu (array);} public static void menu (ArrayList array) / / menu {while (true) {System.out.println ("^ welcom to my system ^"); System.out.println ("please input your choice") System.out.println ("1.add students' information"); System.out.println ("2.remove students' information"); System.out.println ("3.revise students' information"); System.out.println ("4.look over students' information"); System.out.println ("5.find students' information"); System.out.println ("6.quit the system") Scanner sc=new Scanner (System.in); String choice = sc.nextLine (); switch (choice) {case "1": adding (array); break; case "2": removing (array); break Case "3": revising (array); break; case "4": look_over (array); break; case "5": serching (array) Case "6": quiting (); break; default: System.out.println ("error!"); System.exit (0) } public static void adding (ArrayList array) / / add student information {/ / input student data into the member variable System.out.println ("please input student's id"); Scanner sc=new Scanner (System.in); String stu_num=sc.nextLine () If (is_used (array,stu_num) = = false) {System.out.println ("please input student's name"); String stu_name=sc.nextLine (); System.out.println ("please input student's age"); String stu_age=sc.nextLine (); System.out.println ("please input student's room number") String stu_addr=sc.nextLine (); System.out.println ("do you want to add student's grade?yes/no"); / / create student object Student st=new Student (); st.setAge (stu_age); st.setId (stu_num); st.setName (stu_name); st.setRoom_num (stu_addr) / / add student grades String cho=sc.nextLine (); if (cho== "yes") {System.out.println ("please input student's math grade"); int stu_math=sc.nextInt (); System.out.println ("please input student's english grade"); int stu_english= sc.nextInt () System.out.println ("please input student's physic grade"); int stu_physic= sc.nextInt (); st.setMath (stu_math); st.setEnglish (stu_english); st.setPhysic (stu_physic) } / / add student objects to the collection array.add (st); System.out.println ("add successfully");} else {System.out.println ("you are already input information of this student") }} public static void removing (ArrayList array) / / Delete student information {Scanner sc=new Scanner (System.in); System.out.println ("please input student's number"); String stu_num=sc.nextLine (); for (int item0)

Tags: Students information systems management systems management content student numbers objects articles methods learning help variables members grades data data entry easy to understand more organized Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Redmi Docker macOS Huawei