首页  >  文章  >  电脑教程  >  使用Java编写一个简单的学生成绩管理程序

使用Java编写一个简单的学生成绩管理程序

WBOY
WBOY转载
2024-01-16 13:30:181285浏览

使用Java编写一个简单的学生成绩管理程序

使用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("请输入学生人数:");

n=Integer.parseInt(br.readLine());

s=new float[3*n];

for(int i=0;i {

System.out.print("请输入第"+(i+1)+"个学生的3门课程的成绩,以空格分隔:");

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("你输入的"+n+"个学生的成绩是:");

for(int i=0;i {

System.out.println(""+s[i]+" "+s[i+1]+" "+s[i+2]);

}

}

}

JAVA代码。题目如下成绩满分为100分学生成绩记为x

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("请输入学生的成绩: ");

int student_score = student_score_input.nextInt();

if (student_score >= 90 & student_score

System.out.print("该学生的成绩是优");

} else if (student_score >= 80 & student_score

System.out.print("该学生的成绩是良");

} else if (student_score >= 60 & student_score

System.out.print("该学生的成绩是及格");

} else if (student_score >= 0 & student_score

System.out.print("该学生的成绩是不及格");

} else {

System.out.print("输入错误!");

}

} catch (Exception e) {

System.out.print("输入错误!");

}

}

}

以上是使用Java编写一个简单的学生成绩管理程序的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文转载于:docexcel.net。如有侵权,请联系admin@php.cn删除