-
Notifications
You must be signed in to change notification settings - Fork 0
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 #3 from rrk12005/SWF-3-setup-data-models
SWE-3 created data models
- Loading branch information
Showing
3 changed files
with
67 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Account.swift | ||
// | ||
// | ||
// Created by Alan Maynard on 1/23/19. | ||
// | ||
|
||
import Foundation | ||
|
||
class Account: NSObject { | ||
var accountNumber: String | ||
var limit: Double | ||
var balance: Double | ||
var transactions: [Transaction] | ||
var paymentDueDate: Date | ||
var cycleEndDate: Date | ||
|
||
init(accountNumber: String, limit: Double, transactions: [Transaction], paymentDueDate: Date, cycleEndDate: Date) { | ||
self.accountNumber = accountNumber | ||
self.limit = limit | ||
self.transactions = transactions | ||
self.accountBalance = transactions.map { $0.amount }.reduce(0.0, +) | ||
self.paymentDueDate = paymentDueDate | ||
self.cycleEndDate = cycleEndDate | ||
} | ||
} |
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,27 @@ | ||
// | ||
// Transaction.swift | ||
// | ||
// | ||
// Created by Alan Maynard on 1/23/19. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum TransactionType: Int { | ||
case purchase = 0 | ||
case reimbursement = 1 | ||
} | ||
|
||
class Transaction: NSObject { | ||
var type: TransactionType | ||
var amount: Double | ||
var merchantID: String | ||
var date: Date | ||
|
||
init(type: TransactionType, amount: Double, merchantID: String, date: Date) { | ||
self.type = type | ||
self.amount = amount | ||
self.merchantID = merchantID | ||
self.date = date | ||
} | ||
} |