Java programming to achieve student performance management system, using sequential storage structure

Source: Internet
Author: User

The Student Achievement Chart shows


Problem analysis: Use sequential storage structure, so you can inherit sequential table SqList (SqList of sequential table is written before), simplify class description.

The general idea is to establish a sequential table, and then the function of the screening.

A node contains 5 data elements, so the Studentnode node is established as follows:

Import Java.util.Scanner;

public class Studentnode {
	private int number;  School Number
	private String name;  Name
	private String sex;    Sex
	private double 中文版;   College English score
	private double math;     Higher math scores public
	Studentnode () {      //constructor with no arguments this
		(0,null,null,0,0);
	}
	Public studentnode (int number,string name,string sex,double english,double math) {
		this.number=number;
		This.name=name;
		This.sex=sex;
		This.english=english;
		This.math=math;
	}
	Public Studentnode (Scanner SC) {This
		(Sc.nextint (), Sc.next (), Sc.next (), sc.nextdouble (), sc.nextdouble ());
	}



Establish the sequential table and realize the function of checking and deleting

Import java.util.*;
public class Studentmanagesystem extends sqlist{    //The sequential table is constructed sequentially, where parameter maxsize refers to the maximum amount of storage space for the sequential table       public Studentmanagesystem (int maxsize,int n) throws exception{           Super (MAXSIZE);  //Calling parent constructor           Scanner Sc=new Scanner (system.in);           for (int i=0;i<n;i++) {    // Create a sequential table containing n data elements               Studentnode node=new Studentnode (SC);               Insert (node);      //Insert new data elements into the footer of the sequential table          }      }       //Overloaded parent class Insert () method inserts a student information       public void Insert (Studentnode node) at the end of the order table throws exception{          Super.insert (Length (), node);      }      //overwrite parent get () method, remove student information from the sequential table, and return to Studentnode object        public Studentnode get (int number) throws exception{          for (int i=0;i<length (); i++) {  //Traversal sequence table               Studentnode node= ( Studentnode) Super.get (i); //Call parent class SqList get method                if (node.number==number)                    return node;               //Return to specified student information          }            throw new Exception ("School Number" +number+ "does not exist");      }      /Remove method for overriding parent class       public void Remove (int number) throws exception{                for (int i=0;i<length (); i++) {               studentnode node= (studentnode) super.get (i);               if (node.number==number)                    Super.remove (i);               return;           /Early Exit function          }            throw new Exception ("School Number" +number+ "does not exist");      }      //overloaded parent display method, all data elements in output order table       public void display () {          for (int i=0;i<lenGth (); i++) {              try{                   studentnode node = (studentnode) Super.get (i);                   Displaynode ( node);              }        
       catch (Exception e) {}          }      }      //output information for one data element       public void Displaynode ( Studentnode node) {          System.out.println ("School Number:" +node.number+ "Name:" + node.name+ "Gender:" +node.sex+ "English score:" +       node.english+ "Math score:" +node.math);      }       public static void Main (string[] args) throws exception{          int maxsize=100            Scanner sc=new Scanner (system.in);           System.out.println ("Total number of students entered");           int n=sc.nextint ();           System.out.println ("Please enter student information according to school number, name, gender, English score, Math score order");           Studentmanagesystem l=new Studentmanagesystem (maxsize,n);           System.out.println ("Output student Information");           L.display ();           System.out.println ("Enter the student number to be queried");           L.displaynode (L.get (Sc.nextint ()));           System.out.println ("Enter the student number to be deleted");           L.remove (Sc.nextint ());   &Nbsp;       System.out.println ("delete successful");           L.display ();           System.out.println ("Input required additional student information");           L.insert (New Studentnode (SC));           L.display ();

      }  }
Output results


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.