Home >Computer Tutorials >Computer Knowledge >Write a simple student performance management program using Java
import java.io.*;
public class Test
{
public static void main(String[] args) throws Exception
{
int n;
float[] s;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String [] strs;
System.out.print ("Please enter the number of students:");
n=Integer.parseInt(br.readLine());
s=new float[3*n];
for(int i=0;i {
System.out.print ("Please enter the scores of the students' 3 courses" (i 1) "separated by spaces:");
strs=br.readLine().trim().split("\\s ");
s[3*i]=Float.parseFloat(strs[0]);
s[3*i 1]=Float.parseFloat(strs[1]);
s[3*i 2]=Float.parseFloat(strs[2]);
// System.out.println(""" s[3*i] " " s[3*i 1] " " s[3*i 2]);
}
System.out.println ("The scores of the " n " students you entered are: ");
for(int i=0;i {
System.out.println(""" s[i] " " s[i 1] " " s[i 2]);
}
}
}
package test;
import java.util.Scanner;
public class Score {
/**
* @param args
*/
public static void main(String[] args) {
try {
Scanner student_score_input = new Scanner(System.in);
System.out.print ("Please enter the student's score: ");
int student_score = student_score_input.nextInt();
if (student_score >= 90 & student_score
System.out.print ("The student's score is excellent");
} else if (student_score >= 80 & student_score
System.out.print("The student's score is good");
} else if (student_score >= 60 & student_score
System.out.print ("The student's score is passing");
} else if (student_score >= 0 & student_score
System.out.print ("The student's grade is failing");
} else {
System.out.print("Input error!");
}
} catch (Exception e) {
System.out.print("Input error!");
}
}
}
The above is the detailed content of Write a simple student performance management program using Java. For more information, please follow other related articles on the PHP Chinese website!