Import java.util.*;
Import java.io.IOException;
Import java.io.*;
Class student
{
int no;
String name;
Double Chengji;
Public student ()
{};
public student (int no,string name,double Chengji)
{
This.no=no;
This.name=name;
This.chengji=chengji;
}
public int Getno ()
{
return no;
}
Public String GetName ()
{
return name;
}
Public double Getchengji ()
{
return Chengji;
}
public void Setno (int no)
{
This.no=no;
}
public void SetName (String name)
{
This.name=name;
}
public void Setchengji (double chengji)
{
This.chengji=chengji;
}
}
Class Allstudent
{
static int n;
Student p;
Static
{
n=0;
}
}
public class Student3
{
Static allstudent[] Q=new allstudent[100];
public static void cover ()
{
System.out.println ("nnnn");
System.out.println ("TTTT Student performance Management system NN");
System.out.println ("tttt version number 1.0n");
System.out.println ("nnnnnn");
System.out.println ("Tttt 2009.06.04nn");
System.out.println ("Tttt Du Yongpeng n");
}
public static void menu ()
{
System.out.println ("TTTT Student Performance Management System");
System.out.println ("Tttt 1"). Input ");
System.out.println ("Tttt 2"). Display ");
System.out.println ("TTTT 3"). Delete ");
System.out.println ("Tttt 4"). Modification ");
System.out.println ("TTTT 5"). Insert ");
System.out.println ("TTTT 6"). Sort ");
System.out.println ("Tttt 7"). Storage ");
System.out.println ("Tttt 8"). Read ");
System.out.println ("Tttt 0"). Exit ");
System.out.println ("Tttt Please enter the action to be performed:");
}
public static void input ()
{
SYSTEM.OUT.PRINTLN ("Please input class number");
Scanner sc=new Scanner (system.in);
Allstudent.n=sc.nextint ();
Boolean t;
int Sno;
Double Scheng;
String sname;
for (int i=0;i<allstudent.n;i++)
{
SYSTEM.OUT.PRINTLN ("Input" + (i+1) + "Student data (school number, name, grade)");
Sno=sc.nextint ();
Sname=sc.next ();
Scheng=sc.nextdouble ();
Q[i].p=new student (Sno,sname,scheng);
}
}
public static void disp ()
{
System.out.print ("School Number");
System.out.print ("t name");
System.out.println ("T grade");
for (int i=0;i<allstudent.n;i++)
System.out.println ("" "+q[i].p.no+" T "+q[i].p.name+" T "+q[i].p.chengji);
}
public static void Dele ()
{
int i
Boolean t;
SYSTEM.OUT.PRINTLN ("Please Lose Into the deletion student student number ");
Scanner sc=new Scanner (system.in);
do
{
I=sc.nextint ()
if (I>ALLSTUDENT.N)
{
System.out . println ("Input error, please re-enter");
T=true;
}
Else
{
T=false
}
}
while (t),
for (; I<allstudent. n;i++)
{
q[i-1].p.name=q[i].p.name
q[i-1].p.no=q[i].p.no;
Q[i-1]. P.chengji=q[i].p.chengji;
}
allstudent.n--;
SYSTEM.OUT.PRINTLN (delete succeeded.) ");
}
public static void sort ()
{
allstudent[] t=new allstudent[1];
t[0]=new allstudent ();
&nbs P for (int i=0;i<allstudent.n;i++)
{
for (int j=i+1,k=i;j<allstudent.n;j++)
{
& nbsp if (Q[i].p.chengji>q[j].p.chengji)
{
t[0]=q[i];
Q[I]=Q[J];
q[j]=t[0];
}
}
}
System.out.println ("sorted out");
}
;
public static void Insert ()
{
int N=ALLSTUDENT.N
System.out.println ("Enter the new Student Information" (School number, Name, Grade) ");
Scanner sc=new Scanner (system.in);
Q[n].p.no=sc.nextint ();
Q[n].p.name=sc.next ();
Q[n].p.chengji=sc.nextint ();
allstudent.n++;
}
public static void Update ()
{
int i;
Boolean t;
Scanner sc=new Scanner (system.in);
System.out.println ("n Modify the grades of the first few students?") ");
Todo
{
I=sc.nextint ();
if (I>ALLSTUDENT.N)
{
SYSTEM.OUT.PRINTLN ("Input error, please re-enter");
T=true;
}
Else
{
T=false;
}
}
while (t);
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
System.out.println ("Enter student data (school number, name, grade)");
Q[i-1].p.no=sc.nextint ();
Q[i-1].p.name=sc.next ();
Q[i-1].p.chengji=sc.nextint ();
System.out.println ("n" +i+) students ' grades have been revised. ");
}
public static void Main (string[] args)
{
for (int i=0;i<100;i++)
{q[i]=new allstudent ();
Q[i].p=new student ();}
Cover ();
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
int number;
Scanner sc=new Scanner (system.in);
Todo
{
menu ();
Number=sc.nextint ();
Switch (number)
{
Case 1:
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
Input ();
System.out.println ("Press any key to continue");
Try
{
System.in.read ();
catch (IOException e) {}
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
Break
Case 2:
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
Disp ();
System.out.println ("Press any key to continue");
Try
{
System.in.read ();
catch (IOException e) {}
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
Break
Case 3:
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
Dele ();
System.out.println ("Press any key to continue");
Try
{
System.in.read ();
catch (IOException e) {}
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
Break
Case 4:
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
Update ();
System.out.println ("Press any key to continue");
Try
{
System.in.read ();
catch (IOException e) {}
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
Break
Case 5:
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
Insert ();
System.out.println ("Press any key to continue");
Try
{
System.in.read ();
catch (IOException e) {}
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
Break
Case 6:
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
Sort ();
System.out.println ("Press any key to continue");
Try
{
System.in.read ();
catch (IOException e) {}
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
Break
Case 0:
System.exit (0);
Default
System.out.println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
System.out.println ("Re-enter code.) n ");
}
}
while (number!=0);
}
}