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:

Slides:



Advertisements
Similar presentations
CSci 1130 Intro to Programming in Java
Advertisements

Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
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.
Constants and Data Types Constants Data Types Reading for this class: L&L,
Data Types and Expressions
Slides prepared by Rose Williams, Binghamton University Chapter 3 Flow of Control if-else and switch statements.
High-Level Programming Languages
Review Binary –Each digit place is a power of 2 –Any two state phenomenon can encode a binary number –The number of bits (digits) required directly relates.
Chapter 8 High-Level Programming Languages Nell Dale John Lewis.
Data types and variables
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
JavaScript, Fourth Edition
Chapter 2 Data Types, Declarations, and Displays
JavaScript, Third Edition
1 MATERI PENDUKUNG OPERATOR Matakuliah: M0074/PROGRAMMING II Tahun: 2005 Versi: 1/0.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.3 The Class String.
String Escape Sequences
Objectives You should be able to describe: Data Types
1 Variables, Constants, and Data Types Primitive Data Types Variables, Initialization, and Assignment Constants Characters Strings Reading for this class:
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
CSCI 1100/1202 January 16, Why do we need variables? To store intermediate results in a long computation. To store a value that is used more than.
Imperative Programming Part One. 2 Overview Outline the characteristics of imperative languages Discuss other features of imperative languages that are.
Lesson 2 McManus COP  Computational ◦ problems involving some kind of mathematical processing  Logical ◦ Problems involving relational or logical.
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:
Primitive Data Types and Operations Identifiers, Variables, and Constants Primitive Data Types Byte, short, int, long, float, double, char, boolean Casting.
2440: 211 Interactive Web Programming Expressions & Operators.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
CSE 1301 Lecture 2 Data Types Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
CPS120: Introduction to Computer Science
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Course Title: Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
BASICS CONCEPTS OF ‘C’.  C Character Set C Character Set  Tokens in C Tokens in C  Constants Constants  Variables Variables  Global Variables Global.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Beginning Problem-Solving Concepts for the Computer
Assignment An assignment statement changes the value of a variable The assignment operator is the = sign total = 55; Copyright © 2012 Pearson Education,
1 homework Due today: hw #1 (mailing list printout) readings to date: chapter 1 and chapter read appendix B (3 pages on DOS) and and.
VARIABLES, CONSTANTS, OPERATORS ANS EXPRESSION
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
Java Language Basics By Keywords Keywords of Java are given below – abstract continue for new switch assert *** default goto * package.
Chapter 8 High-Level Programming Languages. 2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Java Programming, Second Edition Chapter Two Using Data Within a Program.
Chapter 3 Boolean Expressions Section 3.2 Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
Programming in Java (COP 2250) Lecture 4 Chengyong Yang Fall, 2005.
CPS120: Introduction to Computer Science Variables and Constants.
CHAPTER 2 PROBLEM SOLVING USING C++ 1 C++ Programming PEG200/Saidatul Rahah.
C BASICS QUIZ (DATA TYPES & OPERATORS). C language has been developed by (1) Ken Thompson (2) Dennis Ritchie (3) Peter Norton (4) Martin Richards.
Primitive Data Types 1 In PowerPoint, point at the speaker icon, then click the "Play" button.
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.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
Design A software design specifies how a program will accomplish its requirements A design includes one or more algorithms to accomplish its goal.
 Type Called bool  Bool has only two possible values: True and False.
© 2004 Pearson Addison-Wesley. All rights reserved August 27, 2007 Primitive Data Types ComS 207: Programming I (in Java) Iowa State University, FALL 2007.
Java Variables and Types
Primitive Data Types August 28, 2006 ComS 207: Programming I (in Java)
Multiple variables can be created in one declaration
Basics of ‘C’.
Chapter 2: Java Fundamentals
High Level Programming Languages
Low Level Programming Languages
Chapter 2: Java Fundamentals
The Data Element.
Chap 2. Identifiers, Keywords, and Types
The Data Element.
Review of Java Fundamentals
Programming Fundamental-1
3.0 - Design A software design specifies how a program will accomplish its requirements A design includes one or more algorithms to accomplish its goal.
Presentation transcript:

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: The requirement that only a value of the proper type can be stored into a variable.

3 Data Types Integer numbers Real numbers Characters Boolean values Strings

4 Data Types: Integers The range varies depending upon how many bytes are assigned to represent an integer value. Some high-level languages provide several integer types of different sizes. Operations that can be applied to integers are the standard arithmetic and relational operations.

5 Data Types: Reals Like the integer data type, the range varies depending on the number of bytes assigned to represent a real number. Many high-level languages have two sizes of real numbers. The operations that can be applied to real numbers are the same as those that can be applied to integer numbers.

6 Data Types: Characters It takes one byte to represent characters in the ASCII character set. Two bytes represent each character in the Unicode character set. The English alphabet is represented in ASCII, which is a subset of Unicode.

7 Data Types: Characters Applying arithmetic operations to characters does not make much sense. Comparing characters does make sense, so the relational operators can be applied to characters. The meanings of “less than” and “greater than” when applied to characters are “comes before” and “comes after” in the character set.

8 Data Types: Boolean The Boolean data type consists of two values: true and false. Not all high-level languages support the Boolean data type.

9 Data Types: Strings A string is a sequence of characters considered as one data value. For example: “This is a string.” –Contains 17 characters: one uppercase letter, 12 lowercase letters, three blanks, and a dot. The operations defined on strings vary from language to language. –They include concatenation of strings and comparison of strings in terms of lexicographic order.

10 Declarations Declaration: A statement that associates an identifier with a variable, an action, or some other entity that can be given a name within the language. The programmer can then refer to that item by its name.

11 Declarations Reserved word: A word in a language that has special meaning. These words CANNOT be declared to be anything else. Some languages are NOT case-sensitive: UPPERCASE and lowercase letters are considered the same.

12 Assignment statement Assignment statement: An action statement (not a declaration) that says to evaluate the expression on the right-hand side of the symbol and store that value into the place named on the left-hand side. Most manipulation of data occurs in assignments.