728x90
import java.util.Scanner;
import java.util.Vector;
public class Vector {
public Vector() {
String no[] = new String[5];
String name[] = new String[5];
int kor[] = new int[5];
int eng[] = new int[5];
int mat[] = new int[5];
Scanner input = new Scanner(System.in);
for(int i=0; i<no.length;i++){
System.out.printf("학번을 입력하세요: ");
no[i] = input.next();
System.out.printf("이름을 입력하세요: ");
name[i] = input.next();
System.out.printf("국어점수를 입력하세요: ");
kor[i] = input.nextInt();
System.out.printf("영어점수를 입력하세요: ");
eng[i] = input.nextInt();
System.out.printf("수학점수를 입력하세요: ");
mat[i] = input.nextInt();
}
System.out.printf("학번\t이름\t국어\t영어\t수학\n");
for(int i=0; i<no.length;i++){
System.out.printf("%s\t%s\t%d\t%d\t%d\n",no[i],name[i],kor[i],eng[i],mat[i]);
}
}
public static void main(String[] args) {
new Vector();
Vector v = new Vector(5,10);
}
}
class Student {
}
import java.util.Scanner;
import java.util.Vector;
public class Collection {
class Student {
Vector<Integer> intVector = new Vector<Integer> ();
Vector<String> strVector = new Vector<String>();
Scanner input = new Scanner(System.in);
String hak[];
String name[];
int[] kor,eng,mat,tot;
double avg;
int rank;
public void InScore() {
// for(int i=0; i<strVector.size();i++){
// System.out.printf("학번을 입력하세요: ");
// hak[i] = input.next();
// System.out.printf("이름을 입력하세요: ");
// name[i] = input.next();
// System.out.printf("국어점수를 입력하세요: ");
// kor[i] = input.nextInt();
// System.out.printf("영어점수를 입력하세요: ");
// eng[i] = input.nextInt();
// System.out.printf("수학점수를 입력하세요: ");
// mat[i] = input.nextInt();
// }
// System.out.printf("학번\t이름\t국어\t영어\t수학\n");
// for(int i=0; i<no.length;i++){
// System.out.printf("%s\t%s\t%d\t%d\t%d\n",no[i],name[i],kor[i],eng[i],mat[i]);
// }
for(int i=0; i<strVector.size(); i++){
strVector.add(input.next(hak[i]));
strVector.add(input.next(name[i]));
intVector.add(input.nextInt(kor[i]));
intVector.add(input.nextInt(eng[i]));
intVector.add(input.nextInt(mat[i]));
}
}
}
public static void main(String[] args) {
Collection.Student cs1 = new Collection().new Student();
cs1.InScore();
}
}
개발을 처음 접하던 시절의 낙서장을 옮겨 놓았습니다.
728x90
'낙서장 > JAVA' 카테고리의 다른 글
배열 (0) | 2021.08.08 |
---|---|
String / StringBuffer (0) | 2021.08.08 |
클래스 (0) | 2021.08.08 |
맴버들의 대한 구조 (0) | 2021.08.08 |
while문 (0) | 2021.08.08 |
댓글