Java student achievement management system design and implementation,

Source: Internet
Author: User

Java student achievement management system design and implementation,

The examples in this article share the code of the java Student Achievement Management System for your reference. The details are as follows:

/** @ Copyright by LzyRapx on 2016/4/12. * @ name: java student achievement management system. * @ function: Student-related information, input, query, statistics, and modification .... * @ PS: the student management system of the graphic interface is not required. */import java. util. imports; import java. lang. *; import java. io. *; class Student {private static Student [] s = new Student [100]; // maximum number of students allowed for entry int n = 0; private String name; private int num; private String classAge; private int chinese; private int math; private int english; // determines whether student information has been entered pub Lic void judge () throws IOException {int I; char ch; String str; exist In = new expect (System. in); if (n = 0) {System. out. println ("You have not entered any student information, whether to input (Y/N):"); str = In. next (); ch = str. charAt (0); while (ch! = 'Y' & ch! = 'Y' & ch! = 'N' & ch! = 'N') {System. out. println ("incorrect input. Please enter again:"); str = In. next (); ch = str. charAt (0);} if (ch = 'y' | ch = 'y') {this. add () ;}if (ch = 'n' | ch = 'n') {this. menu () ;}}// menu public void menu () throws IOException // throws an exception and calls this method to handle the exception. If the main method also throws an exception, it is handed over to the Java Virtual Machine for processing, the same below. {int a; vertex in = new partition (System. in); System. out. println ("*************** student information management System **************"); System. out. println ("***** 1. enter student information ****** "); S Ystem. out. println ("***** 2. display student information ****** "); System. out. println ("***** 3. modify student information ****** "); System. out. println ("***** 4. delete student information ****** "); System. out. println ("***** 5. view student information ****** "); System. out. println ("***** 0. log out of the management System ****** "); System. out. println ("************************************* *****"); system. out. print ("select (0 ~ 5): "); a = in. nextInt (); while (a <0 | a> 5) {System. out. print ("the input is invalid. Please enter it again:"); a = in. nextInt ();} switch (a) {case 1: this. add (); break; case 2: this. show (); break; case 3: this. modif (); break; case 4: this. delete (); break; case 5: this. look (); break; case 0: System. out. println ("successfully exited the system !!! "); System. exit (0); break ;}// enter the student information public void add () throws IOException {String str, str1, str2; int I, num1, t = 1; char ch, delimiter; FileWriter fw = new FileWriter ("E: // student.txt", true); // enter the student information to the fw in the specified txt file. write ("input student information list \ r \ n student ID name class language score mathematical score English Score \ r \ n"); student In = new student (System. in); while (t = 1) {System. out. println ("Enter the student ID:"); num1 = In. nextInt (); // determines whether the student ID is repeated for (I = 0; I <n; I ++) {while (s [I]. Num = num1) {System. out. println ("this student ID already exists, please enter it again"); System. out. print ("Enter your student ID:"); num1 = In. nextInt () ;}} s [n]. num = num1; str2 = String. valueOf (num1); fw. write (str2 + ""); System. out. println (); System. out. println ("Enter the Student name:"); s [n]. name = In. next (); fw. write (s [n]. name + ""); System. out. println (); System. out. println ("Enter the student class:"); s [n]. classAge = In. next (); fw. write (s [n]. classAge + ""); System. out. println ("Enter the student's Chinese score: "); S [n]. chinese = In. nextInt (); fw. write (s [n]. chinese + ""); System. out. println ("Enter the student's mathematical score:"); s [n]. math = In. nextInt (); fw. write (s [n]. chinese + ""); System. out. println ("Enter your English score:"); s [n]. english = In. nextInt (); fw. write (s [n]. english + "\ r \ n"); ++ n; fw. close (); System. out. println (); System. out. println ("whether to add (Y/N)"); str = In. next (); ch = str. charAt (0); while (ch! = 'N' & ch! = 'N' & ch! = 'Y' & ch! = 'Y') {System. out. println ("the input is invalid. Please enter it again:"); str = In. next (); ch = str. charAt (0);} if (ch = 'n' | ch = 'n') {break;} System. out. println (); System. out. print ("whether to return to the system main menu (Y/N)"); str1 = In. next (); character = str1.charAt (0); while (character! = 'Y' & found! = 'Y' & found! = 'N' & amp; success! = 'N') {System. out. println ("the input is invalid. Please enter it again:"); str1 = In. next (); lower = str1.charAt (0);} if (lower = 'y' | Lower = 'y') {this. menu ();} if (records = 'n' | records = 'n') {System. out. println (""); System. out. println ("You have exited the system !!! "); System. exit (0) ;}// display the student information public void show () throws IOException {int I; this. judge (); System. out. println ("Total number of students entered in this operation" + n +! "); System. out. println ("the student information you enter is as follows:"); System. out. println (); System. out. println ("student ID \ t name \ t class \ t language \ t mathematics \ t English"); for (I = 0; I <n; I ++) {System. out. println (s [I]. num + "" + s [I]. name + "" + s [I]. classAge + "" + s [I]. chinese + "" + s [I]. math + "" + s [I]. english);} System. out. println ("the system returns to the main menu! "); This. menu ();} // delete student information public void delete () throws IOException {this. judge (); int j = 0, t = 0, k = 0, num1; char ch; String str; sort pin = new sort (System. in); System. out. println ("Enter the student ID to delete:"); num1 = pin. nextInt (); for (j = 0; j <n; j ++) {if (s [j]. num = num1) {k = 1; t = j ;}} if (k = 0) {System. out. println ("Sorry! The student ID you want to delete does not exist! "); System. out. println (" the System will return to the main menu! "); This. menu ();} if (k = 1) {System. out. println ("the student information you want to delete is as follows:"); // print the student information System the administrator wants to delete. out. println ("student ID \ t name \ t class"); // This function does not support extended System temporarily. out. println (s [t]. num + "" + s [t]. name + "" + s [t]. classAge); System. out. println (); System. out. println ("are you sure you want to delete (Y/N):"); str = pin. next (); ch = str. charAt (0); while (ch! = 'Y' & ch! = 'Y' & ch! = 'N' & ch! = 'N') {System. out. println ("the input is invalid. Please enter it again:"); str = pin. next (); ch = str. charAt (0);} if (ch = 'n' | ch = 'n') {System. out. println (); System. out. println ("the system returns to the main menu! "); This. menu () ;}if (ch = 'y' | ch = 'y') {for (j = t; j <n-1; j ++) {s [j] = s [j + 1];} n --; System. out. println ("student data is deleted successfully! "); System. out. println (" the System returns to the main menu! "); This. menu () ;}}// view student information public void look () throws IOException {FileReader fr = new FileReader ("E: // student.txt "); // view the student information int a; while (a = fr. read ())! =-1) {System. out. print (char) a);} fr. close (); System. out. println ("the System returns to the main menu! "); System. out. println (); this. menu ();} // modify the student information public void modif () throws IOException {this. judge (); int j = 0, t = 0, k = 0, num2, num3, moi, c = 1; char ch; String str, str1, str2; pin = new partition (System. in); System. out. println ("Enter the student ID to be modified:"); num2 = pin. nextInt (); for (j = 0; j <n; j ++) {if (s [j]. num = num2) {k = 1; t = j ;}} if (k = 0) {System. out. println ("Sorry! The student ID you want to modify does not exist! "); System. out. println (" the System will return to the main menu! "); This. menu ();} if (k = 1) {// print the student information to be deleted System. out. println ("the student information you want to modify is as follows:"); System. out. println ("student ID \ t name \ t class"); System. out. println (s [t]. num + "" + s [t]. name + "" + s [t]. classAge); System. out. println ("Chinese \ t mathematics \ t English"); System. out. println (s [t]. chinese + "" + s [t]. math + "" + s [t]. english); System. out. println (); System. out. println ("are you sure you want to modify (Y/N):"); str = pin. next (); ch = str. charAt (0); while (ch! = 'Y' & ch! = 'Y' & ch! = 'N' & ch! = 'N') {System. out. println ("the input is invalid. Please enter it again:"); str = pin. next (); ch = str. charAt (0);} if (ch = 'n' | ch = 'n') {System. out. println (); System. out. println ("the system returns to the main menu! "); This. menu ();} while (c = 1) {if (ch = 'y' | ch = 'y') {System. out. println ("************************************* ***"); system. out. println ("***** 1. modify student ID ***** "); System. out. println ("***** 2. modify the class ***** "); System. out. println ("***** 3. change name ***** "); System. out. println ("************************************* ***"); system. out. println ("select:"); moi = pin. nextInt (); switch (moi) {case 1: System. out. print ("enter a new Student ID: "); num3 = pin. nextInt (); s [t]. num = num3; break; case 2: System. out. print ("enter a new class:"); str1 = pin. next (); s [t]. classAge = str1; break; case 3: System. out. print ("enter a new name:"); str2 = pin. next (); s [t]. name = str2; break;} System. out. println ("data modified successfully! ");} System. out. print ("whether to continue modifying (Y/N)"); str = pin. next (); ch = str. charAt (0); System. out. println (); while (ch! = 'Y' & ch! = 'Y' & ch! = 'N' & ch! = 'N') {System. out. print ("the input is invalid. Please enter it again:"); str = pin. next (); ch = str. charAt (0);} if (ch = 'n' | ch = 'n') {break ;}} System. out. println (); System. out. println ("the system returns to the main menu! "); This. menu ();} public static void main (String [] args) throws IOException {Student stu = new Student (); for (int I = 0; I <100; I ++) {s [I] = new Student ();} stu. menu ();}}

Part:




The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.