개발일기/TIL(Since24.04.19)
Java - TIL(24.05.08 수)
w.llama
2024. 5. 8. 22:14
오늘 한 일
- java 리스트 배열 재수강
- 프로그래머스 문풀
- 자연수 뒤집어 배열로 만들기(java)
- 강원도에 위치한 생산 공장 목록 출력하기(SQL)
- HyperSkill 문풀
- 팀과제 수정
- 객체지향에 맞게 메소드 파일 분리(수정 중)
- subject_type_mandatory enum 처리(수정 중)
- enrollsubject -> addsubject(직관성 수정)
- 0,100 -> min max (직관성 수정)
- 방송대 알고리즘 수강
해결 중인 문제
campManagementApplication 에 수강생목록 조회기능을 분리하여 studentmanager 에 작성하는 중인데 student.studentStore 로 불러오면 안된다... private로 작성되어있어 getStudentStore로 수정하여 불러왔는데...campManagementApplication에서 부르면 안되는거같은데... 여기서 어떻게 해야할지 감이안온다...내일 튜터님찾아뵈서 해결해야겠다.
Solution
StudentManager class에 아래와 같은 메소드를 작성
public static void checkStudent(List<Student> studentStore){
System.out.println("\n수강생 목록을 조회합니다...");
if(studentStore.isEmpty()) {
System.out.println("\n등록된 수강생이 없습니다.");
}else {
for (Student student : studentStore) {
System.out.println("수강생 성명: " + student.getStudentName() + " || " + "수강생 ID: " + student.getStudentId());
}
System.out.println("\n수강생 목록 조회 성공!");
}
}
기존 CampManagementApplication 내용 수정(조회 메소드 삭제 & displayStudentView메소드 내의 switch case 2로 연결)
private static void displayStudentView() {
boolean flag = true;
while (flag) {
System.out.println("==================================");
System.out.println("수강생 관리 실행 중...");
System.out.println("1. 수강생 등록");
System.out.println("2. 수강생 목록 조회");
System.out.println("3. 메인 화면 이동");
System.out.print("관리 항목을 선택하세요...");
int input = sc.nextInt();
switch (input) {
case 1 -> createStudent(); // 수강생 등록
case 2 -> StudentManager.checkStudent(studentStore); // 수강생 목록 조회(변경함)
case 3 -> flag = false; // 메인 화면 이동
default -> {
System.out.println("잘못된 입력입니다.\n메인 화면 이동...");
flag = false;
}
}
}
내일 할 일
팀과제 마무리 및 시연 영상 제작
hyperSkill 문풀
프로그래머스 문풀
방송대 운영체제 수강