diff --git a/src/src/domain/Admin.java b/src/src/domain/Admin.java index 1a0a11b..4e6abc1 100644 --- a/src/src/domain/Admin.java +++ b/src/src/domain/Admin.java @@ -8,13 +8,13 @@ public class Admin { private String id; private String password; - private Admin(){ + private Admin() { this.id = "admin"; this.password = "admin123"; } - public static Admin getInstance(){ - if(admin==null){ + public static Admin getInstance() { + if (admin == null) { admin = new Admin(); } return admin; diff --git a/src/src/domain/AmsApp.java b/src/src/domain/AmsApp.java index 4601ad2..52130de 100644 --- a/src/src/domain/AmsApp.java +++ b/src/src/domain/AmsApp.java @@ -63,39 +63,39 @@ public void run() throws IOException { num = scanner.nextLine(); switch (num) { case "1": { - while(true){ - Constant.printRegistrationLectureMenu(); - Constant.printInputText(); - num = scanner.nextLine(); - if (num.equals("1")) { //수강신청 선택 - studentService.showAllLectureList(); - // 원하는 강의 고르기 - System.out.print("수강하고자 하는 강의의 강의 ID를 입력해주세요: \n"); + while (true) { + Constant.printRegistrationLectureMenu(); Constant.printInputText(); - - String choiceLectureId = scanner.nextLine(); - studentService.registerLecture(choiceLectureId); - } else if (num.equals("2")) { //수강신청 취소 - if (studentService.showStudentAllRegistrationLecture()) { - System.out.println("취소하고자 하는 강의의 강의 ID를 입력해주세요: \n"); + num = scanner.nextLine(); + if (num.equals("1")) { //수강신청 선택 + studentService.showAllLectureList(); + // 원하는 강의 고르기 + System.out.print("수강하고자 하는 강의의 강의 ID를 입력해주세요: \n"); Constant.printInputText(); - String lectureId = scanner.nextLine(); - studentService.deleteLecture(lectureId); - } - } else if (num.equals("3")) { - studentService.showStudentAllRegistrationLecture(); - } else if (num.equals("0")) { - break; - } else { - //올바르지 않은 번호 선택 - Constant.incorrectNumber(); - } + String choiceLectureId = scanner.nextLine(); + studentService.registerLecture(choiceLectureId); + } else if (num.equals("2")) { //수강신청 취소 + if (studentService.showStudentAllRegistrationLecture()) { + System.out.println("취소하고자 하는 강의의 강의 ID를 입력해주세요: \n"); + Constant.printInputText(); + String lectureId = scanner.nextLine(); + studentService.deleteLecture(lectureId); + } + + } else if (num.equals("3")) { + studentService.showStudentAllRegistrationLecture(); + } else if (num.equals("0")) { + break; + } else { + //올바르지 않은 번호 선택 + Constant.incorrectNumber(); + } } break; } case "2": { - while(true) { + while (true) { studentService.showStudyRoom(); Constant.printStudyRoomMenu(); Constant.printInputText(); @@ -112,7 +112,7 @@ public void run() throws IOException { Constant.printInputText(); String seatNum = scanner.nextLine(); studentService.cancelReservation(seatNum); - }else if(num.equals("0")){ + } else if (num.equals("0")) { break; } else { Constant.incorrectNumber(); @@ -126,7 +126,8 @@ public void run() throws IOException { studentService.checkNotification(); System.out.println(); break; - } case "4": { + } + case "4": { // 로그아웃 studentService.setStudent((Student) userService.logout()); System.out.println(); @@ -151,12 +152,12 @@ public void run() throws IOException { case "1": { System.out.println("-------------------------------[담당강의 리스트]-----------------------------------"); teacherService.showLectureList(); - System.out.println("-----------------------------------------------------------------------------------------"); + System.out.println("--------------------------------------------------------------------------------"); System.out.println(); break; } case "2": { - if(teacherService.isTeacherLectureListEmpty()){ + if (teacherService.isTeacherLectureListEmpty()) { System.out.println("[현재 담당하고있는 강의가 없습니다.]"); continue; } @@ -188,7 +189,7 @@ public void run() throws IOException { switch (num) { case "1": { - while(true) { + while (true) { adminService.showStudentList(); Constant.printStudentInformationMenu(); Constant.printInputText(); @@ -199,16 +200,16 @@ public void run() throws IOException { editStudentInformation(); } else if (num.equals("3")) { //학생 삭제 deleteStudentInformation(); - } else if(num.equals("0")){ + } else if (num.equals("0")) { break; - }else { + } else { Constant.incorrectNumber(); } } break; } case "2": { - while(true) { + while (true) { adminService.showTeacherList(); Constant.printTeacherInformationMenu(); Constant.printInputText(); @@ -218,7 +219,7 @@ public void run() throws IOException { showDetailTeacher(); } else if (num.equals("2")) { //강사 수정 editTeacherInformation(); - } else if (num.equals("0")) { //뒤로 가기 + } else if (num.equals("0")) { //뒤로 가기 break; } else { Constant.incorrectNumber(); @@ -227,7 +228,7 @@ public void run() throws IOException { break; } case "3": { - while(true) { + while (true) { adminService.showLectureList(); Constant.printLectureInfromationMenu(); Constant.printInputText(); @@ -405,7 +406,7 @@ public void showDetailStudent() throws IOException { System.out.println("[상세정보를 확인하실 학생의 아이디 (뒤로가기: 0번)]"); Constant.printInputText(); studentId = scanner.nextLine(); - if(studentId.equals("0")) + if (studentId.equals("0")) return; System.out.println("*********************************"); if (adminService.detailStudentInformation(studentId)) @@ -421,7 +422,7 @@ public void editStudentInformation() throws IOException { System.out.println("[수정하실 학생의 아이디 (뒤로가기: 0번)]"); Constant.printInputText(); studentId = scanner.nextLine(); - if(studentId.equals("0")){ + if (studentId.equals("0")) { return; } System.out.println("**********************************"); @@ -512,7 +513,7 @@ public void deleteStudentInformation() throws IOException { System.out.println("[삭제하실 학생의 아이디 (뒤로가기: 0번)]"); Constant.printInputText(); studentId = scanner.nextLine(); - if(studentId.equals("0")){ + if (studentId.equals("0")) { return; } System.out.println("*****************************************"); @@ -526,11 +527,11 @@ public void showDetailTeacher() throws IOException { System.out.println("*********************************"); String teacherId; - while(true) { + while (true) { System.out.println("[상세정보를 확인하실 강사의 아이디 (뒤로가기: 0번)]"); Constant.printInputText(); teacherId = scanner.nextLine(); - if(teacherId.equals("0")) + if (teacherId.equals("0")) return; System.out.println("*********************************"); if (adminService.detailTeacherInformation(teacherId)) @@ -544,11 +545,11 @@ public void editTeacherInformation() throws IOException { System.out.println("**********************************"); String teacherId; - while(true) { + while (true) { System.out.println("[수정하실 강사의 아이디 (뒤로가기: 0번)]: "); Constant.printInputText(); teacherId = scanner.nextLine(); - if(teacherId.equals("0")) + if (teacherId.equals("0")) return; System.out.println("*********************************************"); if (adminService.showTeacherInformation(teacherId)) break; // 수정할 학생 찾음 @@ -624,11 +625,11 @@ public void deleteTeacherInformation() throws IOException { System.out.println("**********************************"); String teacherId; - while(true) { + while (true) { System.out.println("[삭제하실 강사의 아이디 (뒤로가기: 0번)]"); Constant.printInputText(); teacherId = scanner.nextLine(); - if(teacherId.equals("0")) return; + if (teacherId.equals("0")) return; System.out.println("**********************************"); if (adminService.newDeleteTeacherInformation(teacherId)) break; @@ -640,11 +641,11 @@ public void showDetailLecture() throws IOException { System.out.println("**********************************"); String lectureId; - while(true) { + while (true) { System.out.println("[상세정보를 확인하실 강의 아이디 (뒤로가기 0번)]"); Constant.printInputText(); lectureId = scanner.nextLine(); - if(lectureId.equals("0")){ + if (lectureId.equals("0")) { return; } System.out.println("**********************************"); @@ -731,15 +732,13 @@ public void deleteLectureInformation() throws IOException { System.out.println("**********************************"); String lectureId; - while(true) { + while (true) { System.out.println("[삭제하실 강의 아이디 (뒤로가기: 0번)]"); Constant.printInputText(); lectureId = scanner.nextLine(); - if(lectureId.equals("0")) return; - if(adminService.newDeleteLectureInformation(lectureId)) + if (lectureId.equals("0")) return; + if (adminService.newDeleteLectureInformation(lectureId)) break; } } - - } diff --git a/src/src/domain/Bank.java b/src/src/domain/Bank.java index 8ff9bde..2890b0c 100644 --- a/src/src/domain/Bank.java +++ b/src/src/domain/Bank.java @@ -10,7 +10,7 @@ public class Bank { private static List accountList; private static int successCount; - static{ + static { accountList = new ArrayList<>(); accountList.add(new Account("111-11-1", "1234", 1000000L)); accountList.add(new Account("222-22-2", "1234", 1000000L)); @@ -19,9 +19,9 @@ public class Bank { } //결제승인체크(학생계좌번호, 계좌비밀번호 맞는지 체크) - public boolean checkAccount(String accountNumber, String accountPassword){ + public boolean checkAccount(String accountNumber, String accountPassword) { for (Account account : accountList) { - if(account.getAccountNumber().equals(accountNumber) && account.getAccountPassword().equals(accountPassword)){ + if (account.getAccountNumber().equals(accountNumber) && account.getAccountPassword().equals(accountPassword)) { return true; } } @@ -29,11 +29,11 @@ public boolean checkAccount(String accountNumber, String accountPassword){ } //학생학원비결제 진행 - public boolean paymentAccount(String accountNumber, Long lectureCost) { + public boolean accountTransfer(String accountNumber, Long lectureCost) { for (Account account : accountList) { - if(account.getAccountNumber().equals(accountNumber)){ - if(account.getBalance() >= lectureCost) { - account.setBalance(account.getBalance() - lectureCost ); + if (account.getAccountNumber().equals(accountNumber)) { + if (account.getBalance() >= lectureCost) { + account.setBalance(account.getBalance() - lectureCost); return true; } else return false; } @@ -42,9 +42,9 @@ public boolean paymentAccount(String accountNumber, Long lectureCost) { } //학생잔액조회 - public long finalBalance(String accountNumber){ + public long getBalance(String accountNumber) { for (Account account : accountList) { - if(account.getAccountNumber().equals(accountNumber)){ + if (account.getAccountNumber().equals(accountNumber)) { return account.getBalance(); } } @@ -52,9 +52,9 @@ public long finalBalance(String accountNumber){ } //효성은행에 존재하는 계좌인지 체크 - public boolean checkAmsAccount(String accountNumber){ + public boolean checkAmsAccount(String accountNumber) { for (Account account : accountList) { - if(account.equals(accountNumber)){ + if (account.equals(accountNumber)) { return true; } } diff --git a/src/src/domain/Lecture.java b/src/src/domain/Lecture.java index 5b0eec8..3823546 100644 --- a/src/src/domain/Lecture.java +++ b/src/src/domain/Lecture.java @@ -7,7 +7,7 @@ import java.util.List; @Data -public class Lecture implements Serializable { +public class Lecture implements Serializable { private String lectureId; //강의아이디 private String lectureName;//강의이름 private int lectureDay;//강의요일 @@ -29,39 +29,38 @@ public Lecture(String lectureId, String lectureName, int lectureDay, int lecture this.lectureTeacherName = lectureTeacherName; this.lectureTeacherId = lectureTeacherId; this.lectureRegistrationIdList = new ArrayList<>(); + this.lectureRegistrationList = new ArrayList<>(); } - public void printLectureInformation(){ - + public void printLectureInformation() { System.out.println("이름: " + lectureName + ", 아이디: " + lectureId); System.out.println("*********************************************"); } - public void printDetailLectureInformation(){ - + public void printDetailLectureInformation() { String realLectureDay = ""; - if(lectureDay == 0){ + if (lectureDay == 0) { realLectureDay = "월요일"; - } else if(lectureDay == 1){ + } else if (lectureDay == 1) { realLectureDay = "화요일"; - } else if(lectureDay == 2){ + } else if (lectureDay == 2) { realLectureDay = "수요일"; - } else if(lectureDay == 3){ + } else if (lectureDay == 3) { realLectureDay = "목요일"; - } else if(lectureDay == 4){ + } else if (lectureDay == 4) { realLectureDay = "금요일"; } String realLectureTime = ""; - if(lectureTime == 0){ + if (lectureTime == 0) { realLectureTime = "10:00 ~ 12:00"; - } else if(lectureTime == 1){ + } else if (lectureTime == 1) { realLectureTime = "13:00 ~ 14:50"; - } else if(lectureTime == 2){ + } else if (lectureTime == 2) { realLectureTime = "15:00 ~ 16:50"; - } else if(lectureTime == 3){ + } else if (lectureTime == 3) { realLectureTime = "17:00 ~ 19:00"; } - System.out.println("이름: " + lectureName + ", 아이디: " + lectureId + ", 강의요일: " + realLectureDay + ", 강의시간: " + realLectureTime + ", 담당강사: " + lectureTeacherName); + System.out.println("이름: " + lectureName + ", 아이디: " + lectureId + ", 강의요일: " + realLectureDay + ", 강의시간: " + realLectureTime + ", 담당강사: " + lectureTeacherName); } } diff --git a/src/src/domain/LectureRegistration.java b/src/src/domain/LectureRegistration.java index 4302cc8..83cff30 100644 --- a/src/src/domain/LectureRegistration.java +++ b/src/src/domain/LectureRegistration.java @@ -9,7 +9,7 @@ @Data @AllArgsConstructor @NoArgsConstructor -public class LectureRegistration implements Serializable { +public class LectureRegistration implements Serializable { //student - lecture의 중간 객체 private Long id; private String lectureId; diff --git a/src/src/domain/Notification.java b/src/src/domain/Notification.java index 2150fb3..402dca4 100644 --- a/src/src/domain/Notification.java +++ b/src/src/domain/Notification.java @@ -8,7 +8,7 @@ @Data -public class Notification implements Serializable { +public class Notification implements Serializable { private int notificationId;//알림아이디 private int checkCount;//읽은 카운트 수 private String adminContent;//학생에게 보여주는 메시지 diff --git a/src/src/domain/Student.java b/src/src/domain/Student.java index 51802bf..b7ae9df 100644 --- a/src/src/domain/Student.java +++ b/src/src/domain/Student.java @@ -1,4 +1,5 @@ package src.domain; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -12,7 +13,7 @@ @Builder @AllArgsConstructor @NoArgsConstructor -public class Student implements Serializable { +public class Student implements Serializable { private String id;//학생 아이디 private String password;//학생 비밀번호 private String name;//학생 이름 @@ -38,8 +39,9 @@ public Student(String id, String password, String name, String gender, String ph this.lectureRegistrationIdList = new ArrayList<>(); this.lectureRegistrationList = new ArrayList<>(); } + //선택된 학생 수정할 수 있는 정보 출력 - public void editStudentInformation(){ + public void printEditStudentInformation() { System.out.println("------------[학생정보수정]-----------"); System.out.println("1. 학생비밀번호: " + password); System.out.println("2. 학생이름: " + name); @@ -49,13 +51,13 @@ public void editStudentInformation(){ } //학생이름, 학생아이디 출력 - public void printStudentInformation(){ - System.out.println("이름: " + name + ", 아이디: " + id ); + public void printStudentInformation() { + System.out.println("이름: " + name + ", 아이디: " + id); System.out.println("**********************************"); } - public void printDetailStudentInformation(){ - System.out.println("---------["+name+" 학생님]"+"---------"); + public void printDetailStudentInformation() { + System.out.println("---------[" + name + " 학생님]" + "---------"); System.out.println("1. 아이디: " + id); System.out.println("2. 성별: " + gender); System.out.println("3. 생년월일: " + birthday); diff --git a/src/src/domain/StudyRoom.java b/src/src/domain/StudyRoom.java index 49cdab2..55b4739 100644 --- a/src/src/domain/StudyRoom.java +++ b/src/src/domain/StudyRoom.java @@ -10,13 +10,6 @@ public class StudyRoom { private static final int ROW = 5; // 임의 할당 -0> 추후 수정 private static final int COL = 5; - - private boolean[][] checkSeat = { - {false, false, false, false, false}, - {false, false, false, false, false}, - {false, false, false, false, false}, - {false, false, false, false, false}, - {false, false, false, false, false} - }; + private boolean[][] checkSeat = new boolean[ROW][COL]; private Map reservationMap = new HashMap<>(); } diff --git a/src/src/domain/Teacher.java b/src/src/domain/Teacher.java index f9da5af..de02273 100644 --- a/src/src/domain/Teacher.java +++ b/src/src/domain/Teacher.java @@ -1,10 +1,10 @@ package src.domain; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import javax.swing.plaf.synth.SynthRadioButtonMenuItemUI; import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -13,7 +13,7 @@ @Builder @AllArgsConstructor @NoArgsConstructor -public class Teacher implements Serializable { +public class Teacher implements Serializable { private String id; private String password; private String name; @@ -24,7 +24,7 @@ public class Teacher implements Serializable { private transient List lectureList; private List lectureIdList; - public Teacher(String id, String password, String name, String gender, String phoneNumber, String birthday, String email){ + public Teacher(String id, String password, String name, String gender, String phoneNumber, String birthday, String email) { this.id = id; this.password = password; this.name = name; @@ -37,7 +37,7 @@ public Teacher(String id, String password, String name, String gender, String ph } //선택된 학생 수정할 수 있는 정보 출력 - public void editTeacherInformation(){ + public void printEditTeacherInformation() { System.out.println("------------[강사정보수정]------------"); System.out.println("1. 강사비밀번호: " + password); System.out.println("2. 강사이름: " + name); @@ -45,14 +45,15 @@ public void editTeacherInformation(){ System.out.println("4. 강사이메일: " + email); System.out.println("------------------------------------"); } + //강사의정보 - public void printTeacherInformation(){ + public void printTeacherInformation() { System.out.println("이름: " + name + ", 아이디: " + id); System.out.println("**********************************"); } - public void printDetailTeacherInformation(){ - System.out.println("---------["+name+" 강사님]"+"---------"); + public void printDetailTeacherInformation() { + System.out.println("---------[" + name + " 강사님]" + "---------"); System.out.println("1. 아이디: " + id); System.out.println("2. 성별: " + gender); System.out.println("3. 생년월일: " + birthday); @@ -60,7 +61,7 @@ public void printDetailTeacherInformation(){ System.out.println("5. 이메일: " + email); System.out.println("-----------[담당강의]------------"); - if(lectureList.isEmpty()){ + if (lectureList.isEmpty()) { System.out.println("현재 담당하고 있는 강의가 없습니다!"); return; }