일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- html5 new tag
- #C++ 연산자함수오버로딩
- html video
- relative path
- #3차원배열
- #CallByAddress
- #JAVASCRIPT
- html charset
- border-box
- #2차원배열
- git flow
- #C++ has~a
- 토큰경제
- html plug-in
- html youtube
- #bubbleSort
- #android activity
- #자바상속#자바이즈어#is~a
- #binary
- html object
- html multimedia
- hyperledger transaction
- docker example
- 하이퍼레저패브릭
- html code
- #성적관리프로그램
- #다차원포인터
- mac terminal command
- html id
- #1차원배열
- Today
- Total
A sentimental robot
Score Management[Three dimensional] 본문
import java.util.Scanner;
public class Hello2 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.print("반의 수 :");
int clas;
clas=sc.nextInt();
System.out.print("학생 수:");
int student;
student=sc.nextInt();
int [][][]score=new int[clas][student][4];
float [][]avg=new float[clas][student];
String [][]name=new String[clas][student];
String []sconame={"Class","Name","kor","eng","mat","total","avg"};
for(int i=0; i<score.length ;i++)
{
System.out.println(sconame[0]+" : "+(i+1)+"반");
for(int j=0; j<score[i].length ;j++) // i+1반의 학생 이름 입력
{
System.out.print(sconame[1]+" : ");
name[i][j]=sc.next();
for(int k=0; k<score[i][j].length-1 ;k++){ // 국,영,수 점수만 입력(합계는 입력대상이 아님-1)
System.out.print(sconame[k+2]+" : ");
score[i][j][k]=sc.nextInt();
score[i][j][3]+=score[i][j][k];
}
avg[i][j]=score[i][j][3]/3;
}
}
// print ALL
for(int i=0; i<score.length ;i++)
{
System.out.print(sconame[0]+" : "+(i+1)+"반");
for(int j=0; j<score[i].length ;j++)
{
System.out.print(sconame[1]+" : ");
System.out.println(name[i][j]);
for(int k=0;k<score[i][j].length;k++){
System.out.print(sconame[k+2]+" : ");
System.out.println(score[i][j][k]);
}
System.out.print(sconame[6]+" : ");
System.out.println(avg[i][j]);
}
}
}
}
'Java' 카테고리의 다른 글
Object-oriented style score management (0) | 2017.12.28 |
---|---|
The elements of "Class" (0) | 2017.12.28 |
Score Management[Two dimensional] (0) | 2017.12.28 |
String class (0) | 2017.12.28 |
foreach문 (0) | 2017.12.28 |