Java Student Performance Management system

Source: Internet
Author: User

/* *@------Ring Chong Mobile End-of-class job------* @copyright by Lzy on 2016/4/12. * @name: Java student Performance management system. *@ function: Students related information, input, query, statistics, modification, etc. * @PS: The graphical interface of the student management system is not required to do. */import java.util.scanner;import java.lang.*;import java.io.*;class student{private static Student[] S=new Student[ 100]; Input student upper Limit int n=0;private string name;private int num;private string classage;private int chinese;private int Math;priv ate int english;//Determine if there is a student information public void judge () throws Ioexception{int I;char ch; String str; Scanner in=new Scanner (system.in), if (n==0) {System.out.println ("You have not entered any student information, whether input (y/n):"); Str=in.next (); ch= Str.charat (0); while (ch!= ' y ' &&ch!= ' y ' &&ch!= ' n ' &&ch!= ' n ') {System.out.println ("input error, please reenter : "); Str=in.next (); Ch=str.charat (0);} if (ch== ' Y ' | | ch== ' y ') {this.add ();} if (ch== ' N ' | | ch== ' n ') {this.menu ();}}} Menus public void menu () throws IOException//throws an exception, calls this method to handle the exception, and if the main method throws an exception, it is given to the Java Virtual machine for processing, as the same. {int A; Scanner in=new Scanner (system.in); System.out.println ("************* Student Information Management System *************"); System.out.priNTLN ("* * * * 1. Input student information ******"); SYSTEM.OUT.PRINTLN ("* * * * 2. Show 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. Exit management system ******"); System.out.println ("******************************************"); System.out.print ("Please select (0~5):"); A=in.nextint (); while (a<0| | a>5) {System.out.print ("input invalid, please reenter:"); A=in.nextint ();} Switch (a) {case 1:this.add (); break;case 2:this.show (); break;case 3:this.modif (); break;case 4:this.delete (); Case 5:this.look (); Break;case 0:system.out.println ("Successful exit system!!! "); System.exit (0); break;}} Enter student information public void Add () throws ioexception{string Str,str1,str2;int I,num1,t=1;char ch,ch1;   FileWriter fw=new FileWriter ("E://student.txt", true); Input the student information into the specified TXT file fw.write ("Input student Information List \r\n\r\n School Number name class Chinese score math performance English results \ r \ n"); Scanner IN=new Scanner (system.in); while (t==1) {System.out.println ("Please enter student number:"); Num1=in.nextint ();//Determine if the number is repeated for (i=0;i<n; i++) {while (S[I].NUM==NUM1) {System.out.println ("This number already exists, please re-enter"); System.out.print ("Please enter the study number:"); Num1=in.nextint ();}} S[n].num=num1;str2=string.valueof (NUM1); Fw.write (str2+ ""); System.out.println (); System.out.println ("Please enter student's name:"); S[n].name=in.next (); Fw.write (s[n].name+ ""); System.out.println (); System.out.println ("Please enter Student class:"); S[n].classage=in.next (); Fw.write (s[n].classage+ "");                   SYSTEM.OUT.PRINTLN ("Please input the student's language score:"); S[n].chinese=in.nextint (); Fw.write (s[n].chinese+ ""); System.out.println ("Please enter student's math score:"); S[n].math=in.nextint (); Fw.write (s[n].chinese+ ""); SYSTEM.OUT.PRINTLN ("Please input student 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 continue adding (y/n)"); Str=in.next (); Ch=str.charat (0); while (ch!= ' n ' &&ch!= ' n ' &&ch!= ' Y ' &&ch!= ' y ') {System.out.println ("input invalid, please reenter:"); Str=in.next (); Ch=str.charat (0);}if (ch== ' N ' | | ch== ' n ') {break;}} System.out.println (); System.out.print ("Return to System main Menu (y/n)"); Str1=in.next (); Ch1=str1.charat (0); while (ch1!= ' y ' &&ch1!= ' y ' & &ch1!= ' n ' &&ch1!= ' n ') {System.out.println ("input invalid, please reenter:"); Str1=in.next (); Ch1=str1.charat (0);} if (ch1== ' Y ' | | ch1== ' y ') {this.menu ();} if (ch1== ' N ' | | ch1== ' n ') {System.out.println (""); SYSTEM.OUT.PRINTLN ("You have exited the system!!! "); System.exit (0);}} Show student Information public void Show () throws Ioexception{int I;this.judge (); System.out.println ("The operation of a total input" +n+ "Students!"); System.out.println ("The Student information you entered is as follows:"); System.out.println ();      System.out.println ("School number \ t name \ t class \ t language \ t math \ 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 ("System returns to 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; Scanner pin=new Scanner (system.in); System.out.println ("Please enter the number to be removed:"); 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 number 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 that the administrator wants to delete System.out.println ("School number \ t name \ t class");// This feature is temporarily unprepared for extensibility System.out.println (s[t].num+ "" +s[t].name+ "" +s[t].classage); System.out.println (); System.out.println ("You are sure to delete (y/n):"); Str=pin.next (); Ch=str.charat (0); while (ch!= ' y ' &&ch!= ' y ' &&ch! = ' n ' &&ch!= ' n ') {System.out.println ("input invalid, please reenter:"); 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 successfully deleted!"); SYSTEM.OUT.PRINTLN ("System returns to main Menu!"); This.menu ();}}}  View student Information public void look () throws IOException {FileReader fr=new filereader ("E://student.txt"); View student information in txt 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 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; Scanner pin=new Scanner (system.in); System.out.println ("Please enter the number 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 number you want to change does not exist! "); SYSTEM.OUT.PRINTLN ("The system will return to the main menu! "); This.menu ();} if (k==1) {//print the student information that will be deleted System.out.println ("You want to modify the student information as follows:"); System.out.println ("School number \ t name \ t class"); System.out.println (s[t].num+ "" +s[t].name+ "" +s[t].classage "); System.out.println ("language \ t math \ t English"); System.out.println (s[t].chinese+ "" +s[t].math+ "" +s[t].english "); System.out.println (); System.out.println ("You are sure to modify (y/n):"); Str=pin.next (); Ch=str.charat (0); while (ch!= ' y ' &&ch!= ' y ' &&ch! = ' n ' &&ch!= ' n ') {System.out.println ("input invalid, please reenter:"); 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 the number * * * * *); SYSTEM.OUT.PRINTLN ("* * * * 2. Modify CLASS * * * * *); SYSTEM.OUT.PRINTLN ("* * * * 3. Change of Name * * * *"); System.out.println ("****************************************"); SYSTEM.OUT.PRINTLN ("Please select:"); Moi=pin.nextint (); switch (moi) {case 1:system.out.print ("Please enter a new number:"); Num3=pin.nextint () ; S[t].num=num3;break;case 2:system.out.print ("Please enter a new class:"); Str1=pin.next (); S[t].classage=str1;break;case 3: System.out.print ("Please enter a new name:"); Str2=pin.next (); s[t].name=str2;break;} SYSTEM.OUT.PRINTLN ("The data has been successfully modified! ");} System.out.print ("Whether to continue to modify (y/n)"); Str=pin.next (); Ch=str.charat (0); System.out.println (); while (ch!= ' y ' &&ch!= ' y ' &&ch!= ' n ' &&ch!= ' n ') {System.out.print ("Invalid input, Please re-enter: "); 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:





If reproduced, please indicate the source. Thank you!

Java Student Performance Management system

Related Article

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.