Class 4 - Variables and Functions Matthew Hashim Click to...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
12/4/09 Click to edit Master subtitle style Variables and Functions Matthew Hashim 9/3/2009 11
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MGMT 290D 12/4/09 Goals for Today n Use variables to store values for use later in a method n Use a variable to store the value of an arithmetic expression n Use a variable to store the value produced by a function 22
Background image of page 2
MGMT 290D 12/4/09 Variables and Functions n Variable: named container for storing/retrieving data n Three types of variables ¨ Method (local): defined for use within a method ¨ Parameter: variable passed to a method ¨ Object (property): used to store an object property n Tools for creating method variables and parameters ¨ Buttons in the upper-right corner of the method box n Tool for creating object variables ¨ Button under the property pane of the details area 33
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MGMT 290D 12/4/09 Variables and Functions (continued) 44
Background image of page 4
MGMT 290D 12/4/09 Method Variables n Defined using create new variable button n Information needed to define a variable ¨ Name: refers to a location in memory ¨ Type: refers to kind of data stored; e.g., a number ¨ Initial value: starting value of specified type; e.g., 1 n Method variables are local (valid only in the method) n Common uses of method variables ¨ Computing and storing values for later retrieval ¨ Storing values entered by a user 55
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MGMT 290D 12/4/09 Example 1: Storing a Computed Value n User story objects: nativeGirl and horse n Objective: move nativeGirl closer to horse n
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/04/2009 for the course MGMT 290 taught by Professor Staff during the Spring '08 term at Purdue University-West Lafayette.

Page1 / 26

Class 4 - Variables and Functions Matthew Hashim Click to...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online