Advertisement
Guest User

Untitled

a guest
Dec 10th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 1.91 KB | None | 0 0
  1. type Transaction() =
  2.         let mutable seqNr = 0
  3.         let mutable accNr = 0
  4.         let mutable kr = 0
  5.         let mutable cent = 0
  6.         member x.sequenceNr
  7.             with get() = seqNr
  8.             and set(value) = seqNr <- value
  9.         member x.AccountNr
  10.             with get() = accNr
  11.             and set(value) = accNr <- value
  12.         member x.amountOfKr
  13.             with get() = kr
  14.             and set(value) = kr <- value
  15.         member x.amountofCent
  16.             with get() = cent
  17.             and set(value) = cent <- value
  18.  
  19.  
  20. let dotransaction(filename:string,accountNumber:int,currentBalance:string) =    let transactions = loadfile filename
  21.                                                                                 let balancearr = currentBalance.Split('.')
  22.                                                                                 let kr = System.Int32.Parse(balancearr.[0])
  23.                                                                                 let cent = System.Int32.Parse(balancearr.[1])
  24.                                                                                 let myAcc = new MyAccount(accountNr = accountNumber, accountCent = cent, accountKr = kr)
  25.                                                                                 let temper = accountNumber
  26.                                                                                 for itr in transactions do
  27.                                                                                     match itr.AccountNr with
  28.                                                                                     | accountNumber -> myAcc.ChangeBalance(itr.amountOfKr,itr.amountofCent)
  29.                                                                                 let result = myAcc.accountKr.ToString()+"."+myAcc.accountCent.ToString()
  30.                                                                                 result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement