成都创新互联网站制作重庆分公司

学生成绩java代码 java学生成绩查询系统代码

如何用Java实现“学生成绩输入”问题?

import java.util.Scanner;\x0d\x0a public class Student{\x0d\x0a public static void main(String[] args){\x0d\x0a Scanner sc = new Scanner(System.in);\x0d\x0a System.out.println("请输入学生的人数....");\x0d\x0a int num = sc.nextInt();\x0d\x0a int[] arr = new int[num];\x0d\x0a double[] chengji_arr = new double[num]; //存放成绩的\x0d\x0a String[] String_arr = new String[num]; //存放姓名的\x0d\x0a String chengjis = "";\x0d\x0a String names = "";\x0d\x0a for(int i = 0; i

创新互联建站是一家专业提供赤坎企业网站建设,专注与成都网站设计、成都做网站、HTML5建站、小程序制作等业务。10年已为赤坎众多企业、政府机构等服务。创新互联专业网络公司优惠进行中。

回答于 2022-11-16

急!急1急!用java编写简单的学生成绩录入程序

这里有一个类

实现学生学号,数学,语文,英语成绩录入

并且计算平均成绩,按照平均成绩高低输出信息

你可以改改!

//实现简单的学生信息输入输出和初步的成绩排序

public

class

student

{

private

int

id;

//学号

private

int

mathscore;

//数学成绩

private

int

chinscore;

//语文成绩

private

int

forescore;

//外语成绩

public

student()

{

id

=

0;

mathscore

=

0;

chinscore

=

0;

forescore

=

0;

}

public

student(int

newid,

int

newmathscore,

int

newchinsvore,

int

newforescore)

{

id

=

newid;

mathscore

=

newmathscore;

chinscore

=

newchinsvore;

forescore

=

newforescore;

}

public

double

getaveragescore()

{

//求平均成绩

double

averagescore

=

((double)

mathscore

+

chinscore

+

forescore)

/

3;

return

averagescore;

}

public

void

output(student

student)

{

//输出对象的内容

system.out.println("

"

+

student.id

+

"

"

+

student.mathscore

+

"

"

+

student.chinscore

+

"

"

+

student.forescore

+

"

"

+

student.getaveragescore());

}

public

int

max(student

a[],

int

n)

{

//student类对象数组的前n项中的成绩最大值的索引

int

position

=

0;

for

(int

i

=

1;

i

n;

i++)

{

if

(a[i].getaveragescore()

a[position].getaveragescore())

{

//比较平均成绩

position

=

i;

}

}

return

position;

}

public

void

selectsort(student

a[])

{

//student类对象数组的选择排序

for

(int

n

=

a.length;

n

1;

n--)

{

int

i

=

max(a,

n);

student

temp

=

a[i];

a[i]

=

a[n

-

1];

a[n

-

1]

=

temp;

}

}

}

编写程序,输入一个学生成绩,给出相应等级:60~100优秀0~50不及格(java代码实现)

import java.util.Scanner;

public class Test {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

System.out.println("请输入学生的分数:");

double score = input.nextDouble();

int level1,level2;

if(score=60.0 score=100.0){

System.out.print("该学生成绩为优秀!");

}

else if(score=0 score60.0){

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

}

else{

System.out.print("您输入的成绩有误!");

}

}    

}

急急急java成绩总成绩和平均分的代码?

//

import java.util.Scanner;

//

public class Test2014 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println("输入学生人数:");

int n = sc.nextInt();

int sum = 0;

for(int i = 1;i = n;++i){

System.out.println("输入第"+i+"个学生成绩:");

sum += sc.nextInt();

}

System.out.println("总成绩是:"+sum+" "+"平均成绩是:"+(double)sum/n);

}

}


名称栏目:学生成绩java代码 java学生成绩查询系统代码
网页路径:http://cxhlcq.com/article/dopphjs.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部