Skip to content
Permalink
f83fe75fab
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
26 lines (23 sloc) 681 Bytes
//
// 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.balance = transactions.map { $0.amount }.reduce(0.0, +)
self.paymentDueDate = paymentDueDate
self.cycleEndDate = cycleEndDate
}
}