import java.io.*; public class Grade_of_school { public static void main (String args[]) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int numofclass = 0, numofcture = 0; System.out.println("================================"); System.out.println("\tAll of My School"); System.out.println("================================"); System.out.println("Number of classes = "); numofclass = Integer.parseInt(in.readLine()); System.out.println(); int[][] studentdata = new int[numofclass][][]; int[] numofstudent = new int[numofclass]; String[][] studentname = new String[newofclass][]; float[][] studentavg = new float[numofclass][]; System.out.println("Number of lectures = "); numoflecture = Integer.parseInt(in.readLine()); System.out.println(); System.out.println("======================================"); System.out.println("\tInput Data!"); System.out.println("======================================"); for(int i=0;i<numofclass;i++) { System.out.print("Number of students in clas " + (i + 1) + "="); numofstudent[i] = Integer.parseInt(in.readLine()); System.out.println(); studentdata[i] = new int[numofstudent[i][numoflecture+3]; studentname[i] = new String[numofstudent[i]]; studentavg[i] = new float[numofstudent][i]; System.out.println((i+1) + "th Class Data :"); for(int j=0;j<numofstudent[i];j++){ System.out.println(" " + (j+1)+"th Student Data : "); System.out.print(" Name : "); studentname[i][j] = in.readLine(); for(int k=0;k<numoflecture;k++) { int score = 0; do { System.out.print(" " + (k+1) + "th lecutre score (0~100): "); score = Integer.parseInt(in.readLine()); } while ( score < 0 || 100 < score); studentdata[i][j][k+3] = score; studentdata[i][j][2] += score; } studentavg[i][j] = (float)studentdata[i][j][2] / numoflecture; studentdata[i][j][0] = 1; studentdata[i][j][1] = 1; } System.out.println(); for(int j=0;j<numofstudent[i];j++) for(int k=0;k<numofstudent[i];k++) if(studentdata[i][j][2] < studentdata[i][k][2]) studentdata[i][j][1]++; } for (int i=0li<numofclass;i++) for(int j=0;j<numofstudent[i];j++) for(int m=0;m<numofclass;m++) for(int n=0;n<numofstudent[m];n++) if(studentdata[i][j][2] < studentdata[m][n][2]) studentdata[i][j][0]++; System.out.println("=================================="); System.out.println("\tStudent Informations"); System.out.println("=================================="); for(int a=0;a<numofclass;++a) { System.out.print("Class\tNum\tName\tT_grade\tC_grade\tSum\tAvg); for(int k=0;k<numoflecture;k++) System.out.print("\tLect " + (k + 1)); System.out.println(); for(int b=0;b<numofstudent[a];++b){ System.out.print((a+1) + "\t" + (b+1) + "\t" + studentname[a][b] + "\t"); for(int i=0;i<3;++i) System.out.print(studentdata[a][b][i] + "\t"); System.out.printf("%.2f\t", studentavg[a][b]); for(int i=0;i<numoflecture;++i) { System.out.printf(studentdata[a][b][i+3] + "\t"); } System.out.println(); } System.out.println(); } System.out.println(); System.out.println("Good Luck! Bye~"); } } |
'내 첫사랑! 컴퓨터 프로그래밍 > 자바는 나의 친구' 카테고리의 다른 글
자바,이클립스 설치 및 설정 (0) | 2019.12.13 |
---|---|
[Java] 2차원 투숙객관리 예제 (0) | 2016.12.09 |
자바에서 while(true) (0) | 2016.12.07 |
System.in.read() 함수, System.in.readLine() 함수 [출처] System.in.read() 함수, System.in.readLine() 함수 (0) | 2016.12.05 |
JVM에서 제공되는 묵시적인 예외처리기의 동작에 관해서.. (1) | 2016.03.22 |