Small program--use array to store scores to determine the level

Source: Internet
Author: User

/*
* Enter student scores from the keyboard, find the highest score, and output the student level
* Tip: First read the number of students, according to the number of students to create an array, storage student scores * *
Package Com.alhh.java;
Import java.util.*;
public class TESTWF {
public static void Main (string[] args) {
Scanner in=new Scanner (system.in);
System.out.println ("Please enter the number of students");
int Count=in.nextint ();//Enter the number of students from the keyboard
Int[] Scores=new int[count];//Create scores array storage scores
int maxscore=0;
for (int i=02;i<scores.length;i++) {
System.out.println ("Please enter the" +i+ "Student's score");
int Score=in.nextint ();//Enter fractions from the keyboard
scores [I]=score;
if (Scores[i]>maxscore) {
Maxscore=scores[i];
}
}
System.out.println ("The highest score is:" +maxscore);
for (int i=0;i<scores.length;i++) {
if (scores[i]>=90&&scores[i]<100) {
System.out.println ("Student score for" +scores[i]+ "is a Grade");
}
else{
System.out.println ("Student score for" +scores[i]+ "is B Grade");
}//can also be subdivided into other grades, which are omitted here
}
}
}

Small program--use array to store scores to determine the level

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.