Realization of Student Information Management Interface with Java
- 2021-10-11 18:46:40
- OfStack
In this paper, we share the specific code of Java to realize the student information management interface for your reference. The specific contents are as follows
Main class
package Student information management system ;
public class Main {
public static void main(String[] args) {
// TODO Automatically generated method stubs
InterFace Menu=new InterFace();
Menu.menu();
}
}
Add information
package Student information management system ;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.Scanner;
public class Add {
static Stu[] stu=new Stu[100];
static Scanner scanner=new Scanner(System.in);
static int number=0;
static InterFace Inter=new InterFace();
public void add() {
while(true) {
try {
clear();
} catch (AWTException e) {
// TODO Automatically generated catch Block
e.printStackTrace();
}
System.out.println(" Please enter the number of people to be entered :");
int N=scanner.nextInt();
for(int i=0;i<N;i++) {
stu[number]=new Stu();
System.out.println(" Please enter the "+(i+1)+" Information about students :");
System.out.println(" Please enter your student number :");
stu[number].setNum(scanner.next());
System.out.println(" Please enter a name :");
stu[number].setName(scanner.next());
System.out.println(" Please enter gender :");
stu[number].setSex(scanner.next());
System.out.println(" Please enter an age :");
stu[number].setAge(scanner.nextInt());
System.out.println(" Please enter your language score :");
stu[number].setChinese(scanner.nextFloat());
System.out.println(" Please enter your math score :");
stu[number].setMath(scanner.nextFloat());
System.out.println(" Please enter your English score :");
stu[number].setEng(scanner.nextFloat());
number++;
}
System.out.println(" Entry completed , Coming back soon !");
Inter.menu();
}
}
// Realize the screen clearing of the console
@SuppressWarnings("deprecation")
public static void clear() throws AWTException
{
Robot r = new Robot();
r.mousePress(InputEvent.BUTTON3_MASK); // Press the right mouse button
r.mouseRelease(InputEvent.BUTTON3_MASK); // Release the right mouse button
r.keyPress(KeyEvent.VK_CONTROL); // Press Ctrl Key
r.keyPress(KeyEvent.VK_R); // Press R Key
r.keyRelease(KeyEvent.VK_R); // Release R Key
r.keyRelease(KeyEvent.VK_CONTROL); // Release Ctrl Key
r.delay(100);
}
}
Main interface
package Student information management system ;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.*;
public class InterFace {
static Scanner scanner=new Scanner(System.in);
public void menu(){
int select;
try {
clear();
} catch (AWTException e) {
// TODO Automatically generated catch Block
e.printStackTrace();
}
do{
System.out.println("\t\t Welcome to Student Information Management System \n");
System.out.println("\t\t *** In fact, in fact, the -- In fact, in fact, the ***\n");
System.out.println("\t\t * The Student information management system The *\n");
System.out.println("\t\t * - *\n");
System.out.println("\t\t * I-I-I-I-I-I-I-I-I-I-I *\n");
System.out.println("\t\t * The 1. Add information 2. Load information *\n");
System.out.println("\t\t * The The *\n");
System.out.println("\t\t * The 3. Query information 4. File operation *\n");
System.out.println("\t\t * The The *\n");
System.out.println("\t\t * The 5. Data sorting 6. Modify information *\n");
System.out.println("\t\t * The The *\n");
System.out.println("\t\t * The 7. Display information 8. Delete information *\n");
System.out.println("\t\t * The The *\n");
System.out.println("\t\t * The 9. Save information 0. Exit the system *\n");
System.out.println("\t\t * I-I-I-I-I-I-I-I-I-I-I *\n");
System.out.println("\t\t ************************************\n");
System.out.println();
System.out.println("\t Please select the operation mode (1~8):\n");
select=scanner.nextInt();
switch(select){
case 8:
break;
case 5:
break;
case 4:
break;
case 3:
break;
case 2:
break;
case 9:
break;
case 7:
Show show=new Show();
show.show();
break;
case 1:
Add operate=new Add();
operate.add();
break;
case 0:
break;
default:
try {
clear();
} catch (AWTException e) {
// TODO Automatically generated catch Block
e.printStackTrace();
}
this.menu();
}
}while(select!=8);
}
@SuppressWarnings("deprecation")
public static void clear() throws AWTException
{
Robot r = new Robot();
r.mousePress(InputEvent.BUTTON3_MASK); // Press the right mouse button
r.mouseRelease(InputEvent.BUTTON3_MASK); // Release the right mouse button
r.keyPress(KeyEvent.VK_CONTROL); // Press Ctrl Key
r.keyPress(KeyEvent.VK_R); // Press R Key
r.keyRelease(KeyEvent.VK_R); // Release R Key
r.keyRelease(KeyEvent.VK_CONTROL); // Release Ctrl Key
r.delay(100);
}
}
Display information
package Student information management system ;
import java.util.Scanner;
public class Show {
int n = Add.number;
static Scanner scanner=new Scanner(System.in);
public void show() {
System.out.println("**********************************************************");
System.out.println(" Student number Name Gender Age Language Mathematics English ");
for (int i = 0; i < n; i++)
System.out.println(Add.stu[i].getNum() + " " +Add.stu[i].getName()+" "+ Add.stu[i].getSex() + " " + Add.stu[i].getAge() + " "
+ Add.stu[i].getChinese() + " " + Add.stu[i].getMath() + " " + Add.stu[i].getEng());
System.out.println("**********************************************************");
System.out.println();
//n Is the number of milliseconds
try { Thread.sleep (100000) ;
} catch (InterruptedException ie){}
}
}
Student category
package Student information management system ;
public class Stu {
private String num;
private String name;
private String sex;
private int age;
private float chinese;
private float math;
private float eng;
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public float getChinese() {
return chinese;
}
public void setChinese(float chinese) {
this.chinese = chinese;
}
public float getMath() {
return math;
}
public void setMath(float math) {
this.math = math;
}
public float getEng() {
return eng;
}
public void setEng(float eng) {
this.eng = eng;
}
}