Open
Conversation
1. 조건반복문으로 메뉴 선택 또는 프로그램을 종료합니다. 2. Student클래스의 생성자 및 소멸자를 통해 학생추가, 삭제를 실행, 안내합니다. 3. Student클래스 객체의 저장속성을 통해 성적추가(변경), 삭제를 실행, 안내합니다. 4. 올바른 메뉴선택 및 입력문자 감별은 에러처리 구문으로 작성하였습니다. 5. Codable프로토콜 및 프로퍼티리스트 파일로 데이터를 백업, 불러올 수 있습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
학생 명단 및 학생별 성적을 관리하는 커맨드 라인 툴을 아래와 같이 구현하였습니다. ↓
개요
주요기능 구현 방법
0. 메뉴 선택
X를 입력하면 해당 case의 코드(데이터 백업 및 문구 출력)를 실행한 뒤 반복문이 종료됩니다.1. 학생 추가
student는 Student객체들을 각각의 name속성(key)에 대응시켜 저장한 공간입니다.student에 새로 생성된 학생객체를 저장합니다.2. 학생 삭제
removeValue(forKey:)가 옵셔널타입이므로, 삭제하고자 하는 값이 있을 경우에만 객체가 지워지며 소멸자가 작동합니다.3. 성적 추가(변경)
(자주 쓰이는 문자열 셋(
이름-과목-성적)은 지역상수에 재할당하여 사용하기 쉽도록 하였습니다.)grades를 가집니다.updateValue(_forKey:)로 없던 과목·성적을 추가하거나 있던 과목 성적을 수정할 수 있습니다.4. 성적 삭제
removeValue(_forKey:)로grades에서 특정과목(및 대응하는 성적)을 삭제할 수 있습니다.5. 평점 조회
grades와 계산속성overallScore를 양식에 맞춰 출력합니다.기타기능 구현 방법
입력문자열 가공 및 에러처리
데이터 백업 및 재사용
Student.students) 백업하고 불러오는 코드를 작성했습니다.