//입력도 틀렸어
/*public void input() {
String name;
int score,kor,eng,math;*/
public String input() {
String[] title = {"kukeo?","yengeo?","suhak?"};
for(int i=0; i<inwon; i++) {
rec[i] =new Record(); //rec의 i번째 방에다가 record 복사해서 넣어라
System.out.println("이름?");//이름?
rec[i].name = sc.next();// record의 name에 저장해야함/ 객체를 저장해야 쓸수 있음
for(int j=0; j<3;j++) {
System.out.println(title[j]);//국어/영어/수학?
rec[i].score[j] = sc.nextInt(); // 수지.국어 점수/ 수지.영어점수/ 수지.수학점수
rec[i].tot += rec[i].score[j];//수지의 누적합/ 인나의 누적합
}
rec[i].ave = rec[i].tot/3; //평균값
}
/* 무식하게 생각하지 말고 논리적으로 생각하자
System.out.println("kukeo?");
pan="";
kor =sc.nextInt();
pan="";
if(kor >=90) {
pan="수";
}else if(kor>=80) {
pan="우";
}else if(kor>=70) {
pan="미";
}else if(kor>=60) {
pan="양";
}else if(kor>=50) {
pan="가";
}
System.out.println("yengeo?");
pan="";
eng =sc.nextInt();
if(eng >=90) {
pan="수";
}else if(eng>=80) {
pan="우";
}else if(eng>=70) {
pan="미";
}else if(eng>=60) {
pan="양";
}else if(eng>=50) {
pan="가";
}
System.out.println("suhak?");
pan="";
math =sc.nextInt();
if(math >=90) {
pan="수";
}else if(math>=80) {
pan="우";
}else if(math>=70) {
pan="미";
}else if(math>=60) {
pan="양";
}else if(math>=50) {
pan="가";
}*/
///////////////////////////////////
String panjeong=""; //변수 만들기
switch(jum/10) {
case 10:
case 9:
pan ="수A"; break;
case 8:
pan ="우B"; break;
case 7:
pan ="미C"; break;
case 6:
pan ="양D"; break;
case 5:
pan ="가F"; break;
}
return pan;
//과목별 판정
}
public void print() {
for(int i=0; i<inwon; i++) {
}
System.out.printf("%6s",rec[i].name);// 이름
for(int j=0; j<3; j++) {
System.out.printf("%4d(%s)",rec[i].score[j],panjeong(rec[i].score[j]));
}
}
}
현재 문제상황
▶문제 1
if 값이 안들어감 ? 어떻게 하지?? →switch 문을 써보면 된다.
▶ 문제 2
1번째 이름 → 남들이 만든 코드를 잘 살펴보고 이용하도록 하자
국/영/수 총점/평균
2번째 이름
국/영/수 총점/평균
'【♣부트 캠프♣】 > ▷부캠- 에러 모음' 카테고리의 다른 글
[24.05.31-11일차] 계산기인데 수식[+-*/]이 안 나오는 이유? (0) | 2024.05.31 |
---|---|
[24.05.30-10일차] No enclosing instance of type TestD is accessible. Must qualify the allocation with an enclosing instance of type TestD (e.g. x.new A() where x is an instance of TestD). (0) | 2024.05.30 |
[24.05.28-8일차] 허리인치를 기입안했다고.. (0) | 2024.05.28 |
[24.05.27-7일차] (0) | 2024.05.27 |
[24.05.24-6일차] (0) | 2024.05.24 |