Jsp Student Score Management System Code

Source: Internet
Author: User

This program only supports the management system basic operation input, output, modify, insert, delete, sort, storage and read, and does not include the file upload function

Jsp tutorial Student Score Management System Code

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 Score Management System nn ");
System. out. println ("tttt version 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 Score 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. Modify ");
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. Return ");
System. out. println ("tttt, enter the operation to be performed :");
}

Public static void input ()
{
System. out. println ("Enter the number of students ");
Pipeline SC = new pipeline (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 (student ID, name, score )");
Sno = SC. nextInt ();
Sname = SC. next ();
Scheng = SC. nextDouble ();
Q [I]. p = new student (sno, sname, scheng );
}
}

Public static void disp ()
{
System. out. print ("student ID ");
System. out. print ("t name ");
System. out. println ("t score ");
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 ("Enter the student ID to delete the student ");
Pipeline SC = new pipeline (System. in );
Do
{
I = SC. nextInt ();
If (I> allstudent. n)
{
System. out. println ("input error, please input again ");
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 ("deleted successfully. ");
}

Public static void sort ()
{
Allstudent [] t = new allstudent [1];
T [0] = new allstudent ();
For (int I = 0; I <allstudent. n; I ++)
{
For (int j = I + 1, k = I; j <allstudent. n; j ++)
{
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 ");
}

Public static void insert ()
{
Int N = allstudent. n;
System. out. println ("Enter New Student Information (student ID, name, score )");
Pipeline SC = new pipeline (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;
Pipeline SC = new pipeline (System. in );
System. out. println ("n modify the score of the first student? ");
Do
{
I = SC. nextInt ();
If (I> allstudent. n)
{
System. out. println ("input error, please input again ");
T = true;
}
Else
{
T = false;
}
}
While (t );
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
System. out. println ("Enter student data (student ID, name, score )");
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 + "Student's score has been modified. ");
}

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 ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Int number;
Pipeline SC = new pipeline (System. in );
Do
{
Menu ();
Number = SC. nextInt ();
Switch (number)
{
Case 1:
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Input ();
System. out. println ("press any key to continue ");
Try
{
System. in. read ();
} Catch (IOException e ){}
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Break;
Case 2:
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Disp ();
System. out. println ("press any key to continue ");
Try
{
System. in. read ();
} Catch (IOException e ){}
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Break;
Case 3:
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Dele ();
System. out. println ("press any key to continue ");
Try
{
System. in. read ();
} Catch (IOException e ){}
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Break;
Case 4:
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Update ();
System. out. println ("press any key to continue ");
Try
{
System. in. read ();
} Catch (IOException e ){}
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Break;
Case 5:
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Insert ();
System. out. println ("press any key to continue ");
Try
{
System. in. read ();
} Catch (IOException e ){}
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Break;
Case 6:
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Sort ();
System. out. println ("press any key to continue ");
Try
{
System. in. read ();
} Catch (IOException e ){}
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
Break;

Case 0:
System. exit (0 );
Default:
System. out. println ("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
System. out. println ("re-enter the code. N ");
}
}
While (number! = 0 );
}
}

This program only supports the management system basic operation input, output, modify, insert, delete, sort, storage and read, and does not include the file upload function

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.