Created
August 11, 2019 17:55
-
-
Save Yerazhas/de9bfe4b86e88e38ad6f51f23f4203db 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
| class Loan { | |
| var expiryDate: String? | |
| var maturityDate: String? | |
| func capital() -> Double { | |
| if expiryDate != nil && maturityDate != nil { | |
| return 10.0 * duration() * riskFactor() | |
| } | |
| if expiryDate != nil && maturityDate == nil { | |
| if getUnusedPercentage() > 1.0 { | |
| return 150.0 * getUnusedPercentage() | |
| } else { | |
| return 200.0 * getUnusedPercentage() | |
| } | |
| } | |
| return 0.0 | |
| } | |
| func duration() -> Double { | |
| return 0.0 | |
| } | |
| func riskFactor() -> 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