Slides - Chapter 3

Slides - Chapter 3 - Chapter3 VariablesandCalculations 1...

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

View Full Document Right Arrow Icon
Chapter 3 Variables and Calculations BMGT 302 Business Application  Programming 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Internal Memory  Internal memory : a component inside a  computer comprised of memory locations Each  memory location  has a unique numeric  address and can hold only one item at a time A programmer can reserve memory locations by  assigning Name : more descriptive words instead of address Data type : indicates the type of data the memory  location will store Initial value Two types of memory locations that a  2
Background image of page 2
Internal Memory (cont'd.) Figure 3-1: Illustration of storage bins 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Variables  Variables : computer memory locations used to  temporarily store data while an application is  running Contents can change during run time Use a meaningful  variable name  that reflects  the purpose of the variable Use  camel casing  for variable identifiers Variable names should conform to naming rules 4
Background image of page 4
How to name a variable 5
Background image of page 5

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

View Full DocumentRight Arrow Icon
Variables (cont'd.) Each variable must be assigned a  data type which determines the memory location’s data  type Each data type is a class (OOP) Integer Long , or  Short  data types can store  integers (whole numbers) Decimal Double , and  Single  data types: store real  numbers (numbers with a decimal place) Char  data type: stores one Unicode character String  data type: stores multiple Unicode characters 6
Background image of page 6
Variables (cont'd.) Unicode Universal coding scheme for characters that assigns a  unique numeric value to each character Other data types Boolean  data type: stores a value of  True  or  False Date  data type: stores date and time information Object  data type: stores any type of data Computer must determine the data type at run time, making it  more inefficient 7
Background image of page 7

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

View Full DocumentRight Arrow Icon
Basic data types in Visual Basic 8 floating-point  numbers  achieve  their greater range  at the expense of  precision
Background image of page 8
Declaring a Variable in Code Declaration statement : used to declare, or create, a  variable Declaration statement includes: Scope/lifetime keyword:  Dim Private , or  Static Name of the variable and data type Initial value (optional) Initialization If not explicitly initialized: Numeric data types: automatically initialized to 0 String  data type: automatically initialized to  Nothing Boolean  data type: initialized to  False 9
Background image of page 9

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

View Full DocumentRight Arrow Icon
How to declare a variable Declaring a Variable in Code (cont’d.) 10
Background image of page 10
How to declare a variable (cont’d.) Declaring a Variable in Code (cont’d.) 11
Background image of page 11

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

View Full DocumentRight Arrow Icon
Assigning Data to an Existing Variable Assignment statement : Used to assign values to properties of controls Used to assign values to variables
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 60

Slides - Chapter 3 - Chapter3 VariablesandCalculations 1...

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

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