java算出数组的平均分_如何计算数组中值的平均等级?

这篇博客是一位编程新手寻求帮助,他们正在尝试编写一个Java程序来计算一组成绩的平均分,并在控制台上打印结果。代码示例中包含了读取学生信息,包括姓名、性别、地址和成绩,但目前的实现只存储了数据,没有计算平均分或出勤率。博主需要指导如何计算平均分以及如何检查出勤率。
摘要由CSDN通过智能技术生成

请帮助我..我一直在努力这个不间断,我仍然无法让它以我想要的方式运行 . 我是编程的新手 . 我不擅长使用方法 . 我在这里有一份工作样本,我的问题是如何获得成绩的平均值以及如何在控制台上打印 . 当我运行此代码时,变量等级中的最后一个值是控制台上显示的唯一值 . 我还需要检查出勤率......我该怎么做?我需要这个代码用于我的决赛 .

包学生监测;

import java.util . *;公共课StudentMonitoring {

public static void main(String[] args) {

Scanner in=new Scanner(System.in);

Date date=new Date();

int[] attend1={},attend2,attend3,grade={};

String line="-------------------------------------------------------------------";

String[] idNum1={},idNum2={},gender={}, name1={},name2={},name3={},name4={},address={},sub={};

扫描仪输入=新扫描仪(System.in); int check = 0,num = 0;

System.out.println(line);

System.out.println("\t\t****STUDENT MONITORING****");

System.out.println(line);

System.out.println("\nGood day teacher, to start using this program input the following information first.\n");

System.out.println(line);

System.out.print("NAME OF SCHOOL: ");

String sName=in.nextLine();

System.out.print("ADDRESS OF SCHOOL: ");

String sAdd=in.nextLine();

System.out.print("SCHOOL IDENTIFICATION NUMBER: ");

String sId=in.nextLine();

System.out.println(line);

System.out.println("STUDENTS INFORMATION");

System.out.println("Enter the year and section of this class");

String yearSec=in.nextLine();

System.out.println("How many student information do you want to input? ");

int numberStudents=in.nextInt();

idNum1=new String[numberStudents];

name1=new String[numberStudents];

name2=new String[numberStudents];

name3=new String[numberStudents];

name4=new String[numberStudents];

attend1=new int[200];

attend2=new int[200];

attend3=new int[200];

address=new String[numberStudents];

grade=new int[100];

gender=new String[numberStudents];

idNum2=new String[numberStudents];

System.out.println("Enter the number of subjects you have: ");

int numSub=in.nextInt();

sub=new String[numSub];

in.nextLine();

for(int x=0;x

System.out.print("Subjec #"+(x+1)+": ");

sub[x]=in.nextLine();

}

for(int x=0;x

in.nextLine();

System.out.println(line);

System.out.println("Student #"+(x+1));

System.out.print("LAST NAME: ");

name1[x]=in.nextLine();

System.out.print("FIRST NAME: ");

name2[x]=in.nextLine();

System.out.print("MIDDLE INITIAL: ");

name3[x]=in.nextLine();

System.out.print("GENDER: ");

gender[x]=in.nextLine();

System.out.print("ADDRESS: ");

address[x]=in.nextLine();

System.out.print("ID NUMBER: ");

idNum1[x]=in.nextLine();

System.out.println(line);

System.out.println("Enter the grades here.");

System.out.println(line);

for (int a=0;a

System.out.print(sub[a]+": ");

grade[a]=in.nextInt();

}

}

System.out.println("This is the list of the students info you've inputted.");

System.out.println("ID Number\t Name\t\t GENDER\t\t ADDRESS");

for(int x=0;x

System.out.println(idNum1[x]+"\t\t"+name1[x]+" "+name2[x]+","+name3[x]+".\t\t"+gender[x]+"\t\t"+address[x]);

}

System.out.println("Subject\t\tGrades");

for(int x=0;x

System.out.println(sub[x]+"\t\t"+grade[x]);

}

System.out.println(line);

System.out.println();

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值