Java learning notes (2) javase simple student management system

Time:2020-11-18

This paper refers toHi guest.com Java actual combat

Java Basics Java student management system

Java student management system

describe

Java SEComprehensive case: student management system.

To viewProblem solving stepsSource codePlease check the original text,Link to original text

subject

The main functions of the system are as follows:

  1. Define aaggregateThe container is used to store all studentsobjectInformation operation.
  2. Add students: input student information through the keyboard and add it to the collection.
  3. Delete student: enter the student number of the student to be deleted through the keyboard, and delete the student object from the collection.
  4. Modify student: input the student number of the student to be modified through the keyboard, and modify other information of the student object.
  5. View students: display the student object information in the collection.
  6. Exit system: end the program.

Problem solving ideas

  1. In the main method, the general interface of the system is designedswitchStatement to execute the corresponding operation according to the user’s choice.
  2. Define two commonmethod, which is used to judge whether the student number is repeated or not and to obtain the index of the object in the collection.
  3. Define add students, delete students, modify students and view students respectively.

Code implementation

Defining student classes

Java learning notes (2) javase simple student management system

The realization of student information management system

Java learning notes (2) javase simple student management system

When the student information is not added, other operations will return the prompt that the student is empty (only one is shown here). The operation is as follows:

Java learning notes (2) javase simple student management system

Add student information (add 3 student information, only one is shown here), and run as follows:

Java learning notes (2) javase simple student management system

Query student information, run as follows:

Java learning notes (2) javase simple student management system

When deleting or updating student information, if the student number entered does not exist, the user will be prompted that the student does not exist and ask the user whether to continue (only one is shown here). The operation is as follows:

Java learning notes (2) javase simple student management system

Delete student information and run as follows:

Java learning notes (2) javase simple student management system

After deleting the student information, query the student information. At this time, it is found that the student information with student number 03 has been deleted. The operation is as follows:

Java learning notes (2) javase simple student management system

Modify student information, run as follows:

Java learning notes (2) javase simple student management system

After modifying the student information, query the student information. At this time, it is found that the student information with student number 01 has been changed. The operation is as follows:

Java learning notes (2) javase simple student management system

Finally, exit the system and run as follows:

Java learning notes (2) javase simple student management system

The above cases use Java se knowledge to realize a simple student information management system.

This work adoptsCC agreementThe author and the link to this article must be indicated in the reprint