189 8069 5689

给学生成绩java代码 java成绩单代码

急!急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;

}

}

}

java ! 学生成绩编程

public static void printResult(){

Scanner input =new Scanner(System.in);

System.out.print("Enter student's name:");

String name=input.next();

System.out.print("Enter student's faculty:");

String faculty=input.next();

System.out.print("Enter student's year:");

String year=input.next();

System.out.print("Enter student's grades:");

Double average=0.0;

String grade=input.next();

//保存各等级的成绩数量

Integer[] results=new Integer[]{0,0,0,0,0};

if(grade!=null||grade!=""){

//保存输入的成绩

String[] grades=grade.split(",");

Double sum=0.0;

for(int i=0;igrades.length;i++){

//将字符串转double类型

Double dg=Double.parseDouble(grades[i]);

sum+=dg;

if(dg50){

//F

results[0]++;

}else if(50=dg  dg=64){

//P

results[1]++;

}else if(65=dg  dg=74){

//C

results[2]++;

}else if(75=dg  dg=84){

//D

results[3]++;

}else if(85=dg  dg=100){

//HD

results[4]++;

}

}

average=sum/grades.length;

}

System.out.println(name+" - "+faculty+" - "+year);

System.out.println("WAM:"+average);

for(int i=0;iresults.length;i++){

switch(i){

case 0:System.out.println(results[i]+" x F");break;

case 1:System.out.println(results[i]+" x P");break;

case 2:System.out.println(results[i]+" x C");break;

case 3:System.out.println(results[i]+" x D");break;

case 4:System.out.println(results[i]+" x HD");break;

}

}

}

如何用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

回答于 2022-11-16

设计一个给班级学生成绩排序的java程序,具体要求如下

按照题目要求编写的Java程序如下(注意 以下程序全部放在Main.java文件中)

class student{

String name;

int score;

public student(String name,int score){

this.name=name;

this.score=score;

}

String studentInfo(){

return "name="+this.name+",score="+this.score;

}

}

public class Main{

public static void main(String[] args){

student sty[]=new student[5];

sty[0]=new student("zhangsan",67);

sty[1]=new student("lisi",75);

sty[2]=new student("wangwu",57);

sty[3]=new student("zhaoliu",88);

sty[4]=new student("ruanqi",93);

student stu[]=new student[5];

for(int i=0;isty.length;i++){

stu[i]=sty[i];

}

for(int i=0;istu.length-1;i++){

for(int j=0;jstu.length-i-1;j++){

if(stu[j].scorestu[j+1].score){

student temp=stu[j];

stu[j]=stu[j+1];

stu[j+1]=temp;

}

}

}

for(int i=0;istu.length;i++){

System.out.println(stu[i].studentInfo());

}

}

}


文章名称:给学生成绩java代码 java成绩单代码
网页链接:http://cdxtjz.com/article/ddgoepd.html

其他资讯