-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Step 2 : 우선순위와 다중처리 (리나) #15
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
cddcec2
Feat: Client에 Priority추가와 Business Type에 loan추가 등
lina0322 a2e1d67
Feat: Client의 등급과 업무를 랜덤하게 초기화
lina0322 0808ffb
Feat: sortClientByPriority로 우선순위 처리
lina0322 1e5e812
Merge: step1 수정사항
lina0322 1469445
Refactor: main함수 안에 반복 사용되는 함수들 밖으로 꺼냄
lina0322 f7a8960
Feat: DashBoard 생성
lina0322 731cdc8
Remove: Teller.workingHours
lina0322 e29cbf7
Refactor: priority와 businessType 랜덤 방식 변경
lina0322 f352b0f
Remove: sortClientByPriority하고, Clients 정렬 방식 변경
lina0322 ec2f607
Refactor: Priority case 네이밍 변경
lina0322 6b6ebdb
Merge: step1 수정
lina0322 c156f4a
Refactor: step1 리뷰관련 추가 수정
lina0322 92cf265
Style: 띄어쓰기 수정
lina0322 cd1a429
Fix: 중간중간 등급이 섞여서 시작되는 것 수정
lina0322 e4867b5
Refactor: main의 private 제거
212b411
Refactor: initClients를 Clients 객체를 따로 만들고, 그 안에서 할 수 있도록 변경
6560e84
Fix: Bank 클래스 내에서, clients의 타입 변경
98ed667
Style: 명수를 의미하는 number는 count로 모두 변경
lina0322 610a87c
Refactor: CustomStringConvertible protocol 적용
lina0322 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,22 +7,22 @@ | |
|
||
import Foundation | ||
|
||
class Dashboard { | ||
struct Dashboard { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 구조체로 바꾼 이유는 무엇인가요? |
||
static func printMenu() { | ||
print(Menu.description, terminator: " ") | ||
} | ||
|
||
static func printStatus(for client: Client, about message: Message) { | ||
let message = String(format: message.rawValue, client.waitingNumber) | ||
static func printStatus(for client: Client, about message: String) { | ||
let message = String(format: message, client.waitingNumber, "\(client.priority)", "\(client.businessType)") | ||
print(message) | ||
} | ||
|
||
static func printCloseMessage(_ number: Int, _ time: TimeInterval?) { | ||
static func printCloseMessage(_ count: Int, _ time: TimeInterval?) { | ||
guard let time = time else { | ||
print(BankError.unknown.description) | ||
print("\(BankError.unknown)") | ||
return | ||
} | ||
let message = String(format: Message.close.rawValue, number, time) | ||
let message = String(format: Message.close, count, time) | ||
print(message) | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,24 +18,36 @@ enum Menu: String { | |
""" | ||
} | ||
|
||
enum Message: String { | ||
case close = "업무가 마감되었습니다. 오늘 업무를 처리한 고객은 총 %d명이며, 총 업무시간은 %.2f초입니다." | ||
case tellerStart = "%d번 고객 업무 시작" | ||
case tellerFinish = "%d번 고객 업무 완료" | ||
enum Message { | ||
static let close = "업무가 마감되었습니다. 오늘 업무를 처리한 고객은 총 %d명이며, 총 업무시간은 %.2f초입니다." | ||
static let tellerStart = "%d번 %@고객 %@업무 시작" | ||
static let tellerFinish = "%d번 %@고객 %@업무 완료" | ||
} | ||
Comment on lines
-21
to
25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. case 을 static let 으로 바꾼 이유는 무엇인가요? |
||
|
||
enum BusinessType { | ||
case normal | ||
enum BusinessType: CaseIterable, CustomStringConvertible { | ||
case deposit | ||
case loan | ||
|
||
var neededTime: TimeInterval { | ||
switch self { | ||
case .normal: | ||
case .deposit: | ||
return 0.7 | ||
case .loan: | ||
return 1.1 | ||
} | ||
} | ||
|
||
var description: String { | ||
switch self { | ||
case .deposit: | ||
return "예금" | ||
case .loan: | ||
return "대출" | ||
} | ||
} | ||
} | ||
|
||
enum BankError: Error { | ||
enum BankError: Error, CustomStringConvertible { | ||
case wrongInput | ||
case unknown | ||
|
||
|
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case 이름을 일반으로 하지 않은 이유가 있나요?