Score Management[Two dimensional]
import java.util.Scanner;
public class Hello2 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.print("Input the number of students:");
int student;
student=sc.nextInt();
int [][]score=new int[student][4];
float []avg=new float[student];
String []name=new String[student];
String []sconame={"Name","kor","eng","mat","total","avg"};
for(int i=0; i<score.length ;i++)
{
System.out.print(sconame[0]+" : ");
name[i]=sc.next(); // i번째 학생 이름 입력
for(int j=0; j<score[i].length-1 ;j++)
{
System.out.print(sconame[j+1]+" : ");
score[i][j]=sc.nextInt(); // i번째 학생의 국어, 영어, 수학 성적 입력
score[i][3]+=score[i][j]; // 국,영,수 점수 합 구하기
}
avg[i]=score[i][3]/3; // i번째 학생의 평균 구하기
}
//print ALL
for(int i=0; i<score.length ;i++){
System.out.print(sconame[0]+" : ");
System.out.println(name[i]);
for(int j=0; j<score[i].length ;j++)
{
System.out.print(sconame[j+1]+" : ");
System.out.println(score[i][j]);
}
System.out.print(sconame[5]+" : ");
System.out.println(avg[i]);
}
}
}