Last active
August 11, 2019 20:08
-
-
Save Yerazhas/00128e3360139b9ab2499e4e10d90b92 to your computer and use it in GitHub Desktop.
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
| final class Loan { | |
| var expiryDate: String? | |
| var maturityDate: String? | |
| private var capitalStrategy: CapitalStrategy | |
| private init(capitalStrategy: CapitalStrategy) { | |
| self.capitalStrategy = capitalStrategy | |
| } | |
| static func termLoan() -> Loan { | |
| return self.init(capitalStrategy: TermLoanCapitalStrategy()) | |
| } | |
| static func revolver() -> Loan { | |
| return self.init(capitalStrategy: RevolverCapitalStrategy()) | |
| } | |
| func capital() -> Double { | |
| return capitalStrategy.capital(loan: self) | |
| } | |
| func duration() -> Double { | |
| return 0.0 | |
| } | |
| func getUnusedPercentage() -> Double { | |
| return 5.0 | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment