Java implements the student achievement Entry System and java student achievement entry

Source: Internet
Author: User

Java implements the student achievement Entry System and java student achievement entry

This article shares with you the java student achievement Entry System for your reference. The details are as follows:

1. Student type, including student name and score of each subject

public class Score {   public String name;   public double EnglishGrade, MathGrade,phyicalGrade,   chemicalGrade,biologicalGrade;   Score() {    }    public Score(String name,double EnglishGrade,       double MathGrade,double phyicalGrade,       double chemicalGrade,double biologicalGrade){     this.name = name;     this.EnglishGrade = EnglishGrade;     this.MathGrade = MathGrade;      this.phyicalGrade = phyicalGrade;     this.chemicalGrade = chemicalGrade;     this.biologicalGrade = biologicalGrade;        }  } 

2. Set student categories, including searching

Package score; public class ScoreZip {Score [] S = new Score [5]; public void setData (Score name, int index) {// Add the Score class to the Score array S [index] = name;} public Score [] getData () {// return the student array return S ;} public Score SerchData (String name) {// search for scores of all subjects for (int index = 0; index <S. length; index ++) {if (name! = Null & S [index]! = Null) if (S [index]. name. equals (name) {return S [index] ;}} return null ;}}

3. Student Score entry and Student Score list

Package score; import java. util. extends; public class ScoreZip2 {public static void main (String [] arr) {Using SC = new using (System. in); ScoreZip Sr = new ScoreZip (); for (int I = 0; I <5; I ++) {// the five-member student detail table is defined here. out. println ("input Student name:"); String name = SC. next (); if (name. equals ("n") {break;} System. out. println ("English score:"); double English = SC. nextDouble (); System. out. println ("Mathematical score :"); Double Math = SC. nextDouble (); System. out. println ("Physical score:"); double Physical = SC. nextDouble (); System. out. println ("Chemical score:"); double Chemical = SC. nextDouble (); System. out. println ("biological score:"); double Biology = SC. nextDouble (); Score s = new Score (name, English, Math, Physical, Chemical, Biology); Sr. setData (s, I);} System. out. println ("========================================== ==== "+" Student renewal table ========================== ======================== "); System. out. println ("Name \ t English Score \ t mathematical Score \ t physical Score \ t chemical score \ t biological score "); score [] B = Sr. getData (); for (Score S: B) {if (S = null) {break;} System. out. println (S. name + "\ t" + S. englishGrade + "\ t" + S. mathGrade + "\ t" + S. phyicalGrade + "\ t" + S. chemicalGrade + "\ t" + S. biologicalGrade);} System. out. println ("Search for student scores? Yes Y no N "); String flag = SC. next (); if (flag. equals ("Y") {System. out. println ("enter the name of the student to be searched:"); String name = SC. next (); Score S = Sr. serchData (name); if (S = null) {System. out. println ("sorry, no student name");} else {double mg = S. mathGrade; double eg = S. englishGrade; double pg = S. phyicalGrade; double cg = S. chemicalGrade; double bg = S. biologicalGrade; double submit = mg + eg + pg + cg + bg; System. out. println ("students to search for:" + name + "\ n:" + mg + "\ n: "+ eg +" \ n physical score: "+ pg +" \ n chemical score: "+ cg +" \ n biological score: "+ bg +" \ n total score: "+ submit );}}}}

Result chart:

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.