-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from jryoun1/step3-lina-develop
Step3 : 업무 중 대기 (리나)
- Loading branch information
Showing
14 changed files
with
240 additions
and
103 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// Clients.swift | ||
// BankManagerConsoleApp | ||
// | ||
// Created by 리나 on 2021/01/12. | ||
// | ||
|
||
import Foundation | ||
|
||
struct Clients { | ||
var list: [Client] = [] | ||
|
||
init(count: Int) { | ||
for waitingNumber in 1...count { | ||
guard let businessType = BusinessType.allCases.randomElement(), let priority = Client.Priority.allCases.randomElement() else { | ||
return | ||
} | ||
let clinet = Client(waitingNumber: waitingNumber, businessType: businessType, priority: priority) | ||
list.append(clinet) | ||
} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
BankManagerConsoleApp/BankManagerConsoleApp/Enum/BusinessType.swift
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// BusinessType.swift | ||
// BankManagerConsoleApp | ||
// | ||
// Created by 리나 on 2021/01/12. | ||
// | ||
|
||
import Foundation | ||
|
||
enum BusinessType: CaseIterable, CustomStringConvertible { | ||
case deposit | ||
case loan | ||
|
||
var neededTime: TimeInterval { | ||
switch self { | ||
case .deposit: | ||
return 0.7 | ||
case .loan: | ||
return 0.3 | ||
} | ||
} | ||
|
||
var description: String { | ||
switch self { | ||
case .deposit: | ||
return "예금" | ||
case .loan: | ||
return "대출" | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
BankManagerConsoleApp/BankManagerConsoleApp/Enum/Menu.swift
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// Menu.swift | ||
// BankManagerConsoleApp | ||
// | ||
// Created by 리나 on 2021/01/12. | ||
// | ||
|
||
import Foundation | ||
|
||
enum Menu: String { | ||
case start = "1" | ||
case end = "2" | ||
|
||
static let description = """ | ||
1: 은행 개점 | ||
2: 종료 | ||
입력 : | ||
""" | ||
} |
16 changes: 16 additions & 0 deletions
16
BankManagerConsoleApp/BankManagerConsoleApp/Enum/Message.swift
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// Message.swift | ||
// BankManagerConsoleApp | ||
// | ||
// Created by 리나 on 2021/01/12. | ||
// | ||
|
||
import Foundation | ||
|
||
enum Message { | ||
static let close = "업무가 마감되었습니다. 오늘 업무를 처리한 고객은 총 %d명이며, 총 업무시간은 %.2f초입니다." | ||
static let tellerStart = "%d번 %@고객 %@업무 시작" | ||
static let tellerFinish = "%d번 %@고객 %@업무 완료" | ||
static let loanStart = "%d번 %@고객 %@심사 시작" | ||
static let loanFinish = "%d번 %@고객 %@심사 완료" | ||
} |
24 changes: 24 additions & 0 deletions
24
BankManagerConsoleApp/BankManagerConsoleApp/Enum/StringFormattingError.swift
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// String.swift | ||
// BankManagerConsoleApp | ||
// | ||
// Created by 임리나 on 2021/01/05. | ||
// | ||
|
||
import Foundation | ||
|
||
|
||
|
||
enum StringFormattingError: Error, CustomStringConvertible { | ||
case wrongInput | ||
case unknown | ||
|
||
var description: String { | ||
switch self { | ||
case .wrongInput: | ||
return "잘못된 입력입니다. 다시 입력해주세요" | ||
case .unknown: | ||
return "알 수 없는 에러가 발생했습니다." | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
BankManagerConsoleApp/BankManagerConsoleApp/HeadOffice.swift
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// HeadOffice.swift | ||
// BankManagerConsoleApp | ||
// | ||
// Created by 임리나 on 2021/01/09. | ||
// | ||
|
||
import Foundation | ||
|
||
final class HeadOffice { | ||
static let shared = HeadOffice() | ||
private let neededTimeToJudgeLoan: TimeInterval = 0.5 | ||
let loanQueue: DispatchQueue = DispatchQueue(label: "HeadOffice") | ||
|
||
private init() {} | ||
|
||
func judgeLoan(for client: Client) { | ||
Dashboard.printStatus(for: client, about: Message.loanStart) | ||
Thread.sleep(forTimeInterval: self.neededTimeToJudgeLoan) | ||
Dashboard.printStatus(for: client, about: Message.loanFinish) | ||
} | ||
} |
Oops, something went wrong.