Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.

Slides:



Advertisements
Similar presentations
Ch. 3 Variables VB.Net Programming. Data Types Boolean – True or False values Short – Small integers (+/- 32,767) Integer – Medium-size integers (+/-
Advertisements

Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Chapter 41 Variables and JSP Control Structures JavaServer Pages By Xue Bai.
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
Data Types in Java Data is the information that a program has to work with. Data is of different types. The type of a piece of data tells Java what can.
©2004 Brooks/Cole Chapter 2 Variables, Values and Operations.
CIS 234: Using Data in Java Thanks to Dr. Ralph D. Westfall.
Basic C Programming Data Types and Arithmetic Operations 01/30/15.
Data types and variables
Chapter 31 Fundamentals of Programming in VB(Continue I) Numbers Arithmetic Operations Variables Incrementing the Value of a Variable.
1 Pertemuan 03 Representing Data Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
Chapter 2 Data Types, Declarations, and Displays
Representation and Conversion of Numeric Types 4 We have seen multiple data types that C provides for numbers: int and double 4 What differences are there.
String Escape Sequences
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
Chapter 2 Data Types, Declarations, and Displays.
Objectives You should be able to describe: Data Types
 Value, Variable and Data Type  Type Conversion  Arithmetic Expression Evaluation  Scope of variable.
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
Variables and Data Types
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
Variable, Expressions, Statements and Operators By: Engr. Faisal ur Rehman CE-105 Fall 2007.
CSE 1301 Lecture 2 Data Types Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Tutorial 6 Introducing Variables, Memory Concepts & Arithmetic.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Knowledge Base C++ #include using std namespace; int main(){} return 0 ; cout
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Boolean Logic Logical Operators Comparison Operators Truth tables.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
PHY-102 SAPVariables and OperatorsSlide 1 Variables and Operators In this section we will learn how about variables in Java and basic operations one can.
Primitive Variables.
Data Types Declarations Expressions Data storage C++ Basics.
Programming with Visual C++: Concepts and Projects Chapter 3A: Integral Data (Concepts)
Copyright © – Curt Hill Types What they do.
Java Programming, Second Edition Chapter Two Using Data Within a Program.
Introduction to Programming Lecture Note - 2 Visual Basic Programming Fundamentals.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
Hungarian Notation A must in this course Every object used MUST be renamed including the form(s) using the following rules Form  frmFormName E.g. frmTemperature.
CIVIL AND GEOMATIC ENGINEERING FT Okyere. CIV 257- COMPUTER PROGRAMMING Lecture 3.
© A+ Computer Science - A reference variable stores the memory address of an object. Monster fred = new Monster(); Monster sally.
Variables Hold information that may be manipulated, used to manipulate other information or remembered for later use A storage location in memory (RAM)
Variables in VB.NET. Variables  A storage location in memory (RAM)  Holds data/information while the program is running  These storage locations can.
Numbers1 Working with Numbers There are times that we have to work with numerical values. When we count things, we need Integers or whole numbers. When.
Murach, Chapter 4. Two Data Types Value Types – Store their own data Reference Types Do not store their own data Stores a reference to an area of memory.
Tokens in C  Keywords  These are reserved words of the C language. For example int, float, if, else, for, while etc.  Identifiers  An Identifier is.
Variables and Expressions Programming Right from the Start with Visual Basic.NET 1/e 7.
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
Creation of Variables with Numeric, alphanumeric, date, picture, memo data types Constant - A quantity that does not change during the execution of a program.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
1Object-Oriented Program Development Using C++ Built-in Data Types Data type –Range of values –Set of operations on those values Literal: refers to acceptable.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
A variable is a name for a value stored in memory.
BASIC ELEMENTS OF A COMPUTER PROGRAM
Visual Basic Variables
Chapter 6: Data Types Lectures # 10.
Data Types, Arithmetic Operations
ITEC113 Algorithms and Programming Techniques
Object Oriented Programming
EPSII 59:006 Spring 2004.
Multiple variables can be created in one declaration
Numbers.
Chapter 2 Variables.
Chapter 2: Java Fundamentals
Chapter 2: Java Fundamentals
The Data Element.
The Data Element.
Chapter 2 Primitive Data Types and Operations
Variables and Constants
Presentation transcript:

Operators & Identifiers The Data Elements

Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division ( integer remainder ) addition Subtraction assignment ^ * / \ Mod + - =

Evaluate these expressions = 100 / 10 / 5 = 100 / 10 \ 5 = 100 \ 10 / 5 = Mod 5 = \ 5

Evaluate these expressions = 100 / 10 / 52 = 100 / 10 \ 5 = 100 \ 10 / 5 = Mod 5 = \ 5

Evaluate these expressions = 100 / 10 / 52 = 100 / 10 \ 52 = 100 \ 10 / 5 = Mod 5 = \ 5

Evaluate these expressions = 100 / 10 / 52 = 100 / 10 \ 52 = 100 \ 10 / 550 = Mod 5 = \ 5

Evaluate these expressions = 100 / 10 / 52 = 100 / 10 \ 52 = 100 \ 10 / 550 = Mod 5100 = \ 5

Evaluate these expressions = 100 / 10 / 52 = 100 / 10 \ 52 = 100 \ 10 / 550 = Mod 5100 = \ 5102

Variables A variable is a string used to identify a memory location. The amount of memory is determined by the type of data that it will store. Typically, variable names need to be declared so the operating system can allocate sufficient space. Then values of the specified type can be assigned, i.e. stored in that location.

Variable Names in VB Must begin with a letter –Can include letters and numerals –Cannot include spaces Use names that are descriptive Capitalising convention –InterestRate, InitialCapital

Variables Local (procedure-level) –Declared within a subprogram –Dim varName As dataType Global (module-level) –Declared at the top of the code listing –Private varName As dataType

Data Types Boolean2 bytesTrue or False (1 or 0) Char2 bytes0 to 65,535 representing the Unicode character set Date8 bytes0:00:00 on 1/1/0001 to 23:59:59 on 31/12/9999 Decimal16 bytes +/- 79,228,162,514,264,337,593,543,950,335 +/ Double8 bytes +/ X to +/ X Integer4 bytes-2,147,483,648 to 2,147,483,647 Long8 bytes -9,223,382,036,854,775,808 to 9,223,382,036,854,775,807 Object4 bytesany type Short2 bytes-32,768 to 32,767 Single4 bytes+/ X to +/ X String0 to approximately 2 billion characters

The ASCII Character Set

Data Storage (Short type) =255

Data Storage (2nd byte) = The largest Unsigned value that can be stored in 16 bits. How many patterns are there?

Short Integers To store integers, half the combinations are used to represent negative values. The range for Integer type variables is: -32,768 to The MSB is used to represent the sign. Which value of the sign bit (0 or 1) will represent a negative number?

Integer Storage (4 bytes) High order bit (MSB) is worth 2 31 The number of different combinations =2 32 =4,294,967,296 Half are used for negative values, so the range is –2,147,483,648 to + 2,147,483,647

Long Integers In 8 bytes there are 64 bits! High order bit (MSB) is worth The number of different combinations =2 64 =18,446,744,073,709,650,616 Ranging from -9,223,382,036,854,775,808 to 9,223,382,036,854,775,807

Data Type Conversion