Presentation is loading. Please wait.

Presentation is loading. Please wait.

Financial Information Management Stefano Grazioli.

Similar presentations


Presentation on theme: "Financial Information Management Stefano Grazioli."— Presentation transcript:

1 Financial Information Management Stefano Grazioli

2 Critical Thinking  Office hours posted on web site  Dreamspark on your Mac  Lab @ 9am on Thu.  VirtualLabs inaccuracies – extra credit  Easy meter

3 Renaming a Project 1.Unzip & Make a copy of the folder 2.Keep only the folder that contains the.vbproj file and all its contents. Delete the rest. 3.Change the name of that folder to the new name. 4.Click on.vbproj to start VS and change all filenames from inside VS.

4 You do the talking  Name, Major  Learning objectives  What you like about the class  What can be improved  Attitude towards the Tournament

5 Financial Information Management Procedures Lasagne and Tagliatelle

6 SUBroutines are Recipes

7 Procedures: Sub  A procedure is a named sequence of steps  Purpose: reusing & simplify existing code (reduce total cost)  Good practice:shorter than a single screen  Sometimes it takes arguments  Subs and Functions  “Macro” is an old name for procedure, and it is often used in industry to refer to procedures written for MS applications such as Excel.  A procedure is a named sequence of steps  Purpose: reusing & simplify existing code (reduce total cost)  Good practice:shorter than a single screen  Sometimes it takes arguments  Subs and Functions  “Macro” is an old name for procedure, and it is often used in industry to refer to procedures written for MS applications such as Excel. Public Sub MyProcedure(myNumber As Integer) Dim sum As Integer = 0 For i As Integer = 1 To myNumber sum = sum + i Next ShowTheUser(sum) End Sub Private Sub ShowTheUser(someNum As Integer) Application.ActiveCell.Value = _ "The result is " + someNum.ToString("N0") End Sub

8 Variables (data)  Variables are names for physical places in your computer memory  Variables have a lifecycle  Variables have a scope  Globals vs Locals  Find the vars in here Globals? Locals?  Variables are names for physical places in your computer memory  Variables have a lifecycle  Variables have a scope  Globals vs Locals  Find the vars in here Globals? Locals? Dim sum As Integer = 0 Public Sub MyProcedure(myNumber As Integer) For i As Integer = 1 To myNumber sum = sum + i Next ShowTheUser() End Sub Private Sub ShowTheUser() Application.ActiveCell.Value = _ "The result is " + sum.ToString("N0") End Sub

9 Procedures: Functions outputoutput Private Function CalcInterest(r As Double, principal As Double, t As Double) _ As Double Dim interest as Double = 0 interest = principal * ((((1 + r)^t) - 1) return interest End Function  Return a single value  Conceptually similar to the formulas in your worksheets  Return a single value  Conceptually similar to the formulas in your worksheets inputinput

10 Argument Binding ‘ A function Private Function CalcInterest(r As Double, principal As Double, t As Double) As Double … ‘ No binding myInt = CalcInterest(0.05, 1000, 10) ‘ With binding (typical use) myRate = 0.05 userPrincipal = 1000 years = 10 myInt = CalcInterest(myRate, userPrincipal, years) Often difficult to understand for beginners

11 Arguments vs. Globals  Arguments are considered a best practice  Arguments have shorter lifecycle -> more efficient  With arguments, changing variables is made more explicit -> less errors  A global is a variable defined outside of a Sub/Function  Use globals if variables have an extended life, are small, and are used by many procedures

12 Financial Information Management WINIT What Is New In Technology?

13 Financial Information Management Homework Using Subs & Functions


Download ppt "Financial Information Management Stefano Grazioli."

Similar presentations


Ads by Google