Ex: If you use a program to record sales, you will want to remember data:


 Arline Simpson
 1 years ago
 Views:
Transcription
1 Data
2 Variables Programs need to remember values. Ex: If you use a program to record sales, you will want to remember data: A loaf of bread was sold to Sione Latu on 14/02/19 for T$1.00. Customer Name: Sione Latu Date Sold: 14/02/19 Item Sold: Loaf of Bread Item Cost: T$1.00 Variables Places in the computer s memory where we can store information. Values and Objects are stored in variables. Numbers Characters Strings Dates
3 Value Types vs. Reference Types Value Types only store a value Integer only stores: Boolean only stores: True False Reference Types store a reference to an object A reference is a location in memory The location is the starting point of an object
4 Primitive Data Types Primitives  The basic types supported by the programming language. Use lowercase for primitive data types in code Type Size (bits) Value Range byte to 127 short 1632,768 to int 322,147,483,648 to 2,147,483,647 long x to 9.2 x float x to 3.4 x double x to 1.8 x char 16 0 to 65,535 boolean 1 True or False
5 Primitive Data Type Selection Practice How to choose the right primitive variable type. Byte, Short, Int and Long store whole numbers. Float and Double store fractions. Double is more accurate, so if accuracy is important, use double. If you pick something that is too big, you re wasting memory space. Wasting memory space slows things down. If you pick something that is too small, then you re going to crash. If you need a character, use Char. If you need a true/false value, use Boolean. What is a good data type for: Someone s age? A customer s identification number for a video rental store in Nuku alofa? A very large number with decimals? The price of an item?
6 Using Primitive Variables 2 Steps to using variables 1. Declare the variable 2. Initialize the variable
7 Declaring Primitive Variables 1 Declare the variable Tell the computer to reserve a space in memory for the variable. You need to tell the computer 2 things: 1. Name of the variable 2. Type of the variable (What kind of variable you have) Primitive types byte short int long float double char boolean Name Type
8 Declaring Primitive Variables 2 Use a name that is easy to remember. Do not use x, y, z Variable names must start with a letter, underscore or dollar sign. Begin variables with a lowercase character. Then, use a capital letter for each word. Examples firstname customerid
9 Initializing Primitive Variables Initialize the variable Assign an initial value to a variable. Char values must be enclosed in single quotes. String values must be enclosed in double quotes. Boolean value should be True or False Initial Value
10 Declaring and Initializing Primitive Variables in 1 line You can declare and initialize a variable in 1 line.
11 Converting Variable Values Smaller to Larger It is possible to move a value from a variable with a smaller type to a variable with a larger type Example Maximum Short Value Maximum Long Value Is 9.2 x 10 15
12 Converting Variable Values Larger to Smaller If a value from a variable with a larger type is moved into a variable with smaller type, it may be too big for the smaller type This will cause an error to occur when you run it Maximum Using this: Short Value is Results in: Do not do this!
13 Converting Variable Types You can convert variable types by casting it. To cast, use this format: (<desired data type>)variable int is bigger than a byte Casting from a datatype to a smaller datatype is not recommended! Without this, we Would get an error If the Cast function isn t able to convert the value, you will get an error.
14 Arithmetic Operators Operator Meaning Example + Addition Subtraction * Multiplication 5 * 6 / Division 21 / 3 % Modulus 12 percent 2 Declare and Initialize x, y and z Get values from x and y Adds x and y together Assigns the sum of x an y to z
15 Arithmetic Operator Details Addition You can add strings. Adding strings is called concatenation. This converts all non strings into strings. Make sure you add your numbers before converting them to strings. You can t add other objects.
16 Arithmetic Operator Details Division Tricky because result may not be an integer. In this case the number gets cut off. NOT rounding Even having a result of float doesn t work. Because Java has rules for dealing with data types. The result of a division between two integers is always an integer. So the float just added a.0 to it. To get around this, we need to diving two floats!
17 Arithmetic Operator Details Subtraction You can t subtract strings or other objects Multiplication User asterisk (*) instead of x Modulus The remainder of a division Can be used to determine whether a number is divisible by another number Can also determine if a number is even or odd
18 Order of Operations When you have a lot of operations, they are performed in a certain order. Operations in Parentheses () Exponentiation operations from left to right Multiplication or Division operations from left to right Addition or Subtraction operations from left to right Please Excuse My Dear Aunt Sally. Examples: / 3 = = 12 ( ) / 3 = 18 / 3 = 6 (5 + 3) / 2 ^ 2 = 8 / 2 ^ 2 = 8 / 4 = 2
COMP Primitive and Class Types. Yi Hong May 14, 2015
COMP 110001 Primitive and Class Types Yi Hong May 14, 2015 Review What are the two major parts of an object? What is the relationship between class and object? Design a simple class for Student How to
More informationBasics of Java Programming
Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements  A statement is some action or sequence of actions, given as a command in code. A statement
More informationDatatypes, Variables, and Operations
Datatypes, Variables, and Operations 1 Primitive Type Classification 2 Numerical Data Types Name Range Storage Size byte 2 7 to 2 7 1 (128 to 127) 8bit signed short 2 15 to 2 15 1 (32768 to 32767) 16bit
More informationExpressions and Data Types CSC 121 Spring 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
More informationData and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence
Data and Variables Data Types Expressions Operators Precedence String Concatenation Variables Declaration Assignment Shorthand operators Review class All code in a java file is written in a class public
More informationCCBC Math 081 Order of Operations Section 1.7. Step 2: Exponents and Roots Simplify any numbers being raised to a power and any numbers under the
CCBC Math 081 Order of Operations 1.7 1.7 Order of Operations Now you know how to perform all the operations addition, subtraction, multiplication, division, exponents, and roots. But what if we have a
More informationProgram Fundamentals
Program Fundamentals /* HelloWorld.java * The classic Hello, world! program */ class HelloWorld { public static void main (String[ ] args) { System.out.println( Hello, world! ); } } /* HelloWorld.java
More informationExpressions and Data Types CSC 121 Fall 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and
More informationThe Order of Operations. Unit 1 Lesson 3
Unit 1 Lesson 3 Students will be able to: Perform arithmetic operations, including those involving wholenumber exponents, in the conventional order. Key Vocabulary: Parentheses, exponents, multiplication,
More informationData types Expressions Variables Assignment. COMP1400 Week 2
Data types Expressions Variables Assignment COMP1400 Week 2 Data types Data come in different types. The type of a piece of data describes: What the data means. What we can do with it. Primitive types
More informationFull file at
Java Programming, Fifth Edition 21 Chapter 2 Using Data within a Program At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional
More informationDeclaration and Memory
Declaration and Memory With the declaration int width; the compiler will set aside a 4byte (32bit) block of memory (see right) The compiler has a symbol table, which will have an entry such as Identifier
More informationECE 122 Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 3 Expression Evaluation and Program Interaction Outline Problem: How do I input data and use it in complicated expressions Creating complicated expressions
More informationCS 106 Introduction to Computer Science I
CS 106 Introduction to Computer Science I 05 / 31 / 2017 Instructor: Michael Eckmann Today s Topics Questions / Comments? recap and some more details about variables, and if / else statements do lab work
More informationTOPIC 2 INTRODUCTION TO JAVA AND DR JAVA
1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared
More informationChapter 2: Using Data
Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are 2 31 through 2 311. These are the highest and lowest values that
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics
Java Programming, Sixth Edition 21 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional
More informationObjectOriented Programming
ObjectOriented Programming Java Syntax Program Structure Variables and basic data types. Industry standard naming conventions. Java syntax and coding conventions If Then Else Case statements Looping (for,
More informationPrimitive Types. Four integer types: Two floatingpoint types: One character type: One boolean type: byte short int (most common) long
Primitive Types Four integer types: byte short int (most common) long Two floatingpoint types: float double (most common) One character type: char One boolean type: boolean 1 2 Primitive Types, cont.
More informationMODULE 02: BASIC COMPUTATION IN JAVA
MODULE 02: BASIC COMPUTATION IN JAVA Outline Variables Naming Conventions Data Types Primitive Data Types Review: int, double New: boolean, char The String Class Type Conversion Expressions Assignment
More informationReserved Words and Identifiers
1 Programming in C Reserved Words and Identifiers Reserved word Word that has a specific meaning in C Ex: int, return Identifier Word used to name and refer to a data element or object manipulated by the
More informationBASIC ELEMENTS OF A COMPUTER PROGRAM
BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators
More informationLecture Set 4: More About Methods and More About Operators
Lecture Set 4: More About Methods and More About Operators Methods Definitions Invocations More arithmetic operators Operator Side effects Operator Precedence Shortcircuiting main method public static
More informationExpressions and Data Types CSC 121 Spring 2017 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
More informationSummer Assignment Glossary
Algebra 1.1 Summer Assignment Name: Date: Hour: Directions: Show all work for full credit using a pencil. Circle your final answer. This assignment is due the first day of school. Use the summer assignment
More informationLesson 02 Data Types and Statements. MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL
Lesson 02 Data Types and Statements MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Topics Covered Statements Variables Constants Data Types
More informationLesson 3: Basic Programming Concepts
3 ICT Gaming Essentials Lesson 3: Basic Programming Concepts LESSON SKILLS After completing this lesson, you will be able to: Explain the types and uses of variables and operators in game programming.
More informationProfessor: Sana Odeh Lecture 3 Python 3.1 Variables, Primitive Data Types & arithmetic operators
1 Professor: Sana Odeh odeh@courant.nyu.edu Lecture 3 Python 3.1 Variables, Primitive Data Types & arithmetic operators Review What s wrong with this line of code? print( He said Hello ) What s wrong with
More informationAn Introduction to Processing
An Introduction to Processing Variables, Data Types & Arithmetic Operators Produced by: Dr. Siobhán Drohan Mairead Meagher Department of Computing and Mathematics http://www.wit.ie/ Topics list Variables.
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. A Guide to this Instructor s Manual:
Java Programming, Eighth Edition 21 Chapter 2 Using Data A Guide to this Instructor s Manual: We have designed this Instructor s Manual to supplement and enhance your teaching experience through classroom
More informationThese are reserved words of the C language. For example int, float, if, else, for, while etc.
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 a sequence of letters and digits, but must start with a letter.
More informationCS 112 Introduction to Programming
CS 112 Introduction to Programming Java Primitive Data Types; Arithmetic Expressions Yang (Richard) Yang Computer Science Department Yale University 308A Watson, Phone: 4326400 Email: yry@cs.yale.edu
More informationAdmin. CS 112 Introduction to Programming. Recap: Java Static Methods. Recap: Decomposition Example. Recap: Static Method Example
Admin CS 112 Introduction to Programming q Programming assignment 2 to be posted tonight Java Primitive Data Types; Arithmetic Expressions Yang (Richard) Yang Computer Science Department Yale University
More informationDATA TYPES AND EXPRESSIONS
DATA TYPES AND EXPRESSIONS Outline Variables Naming Conventions Data Types Primitive Data Types Review: int, double New: boolean, char The String Class Type Conversion Expressions Assignment Mathematical
More informationREVIEW. The C++ Programming Language. CS 151 Review #2
REVIEW The C++ Programming Language Computer programming courses generally concentrate on program design that can be applied to any number of programming languages on the market. It is imperative, however,
More informationCSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI
CSCI 2010 Principles of Computer Science Data and Expressions 08/09/2013 CSCI 2010 1 Data Types, Variables and Expressions in Java We look at the primitive data types, strings and expressions that are
More informationCOMP 110 Introduction to Programming. What did we discuss?
COMP 110 Introduction to Programming Fall 2015 Time: TR 9:30 10:45 Room: AR 121 (Hanes Art Center) Jay Aikat FB 314, aikat@cs.unc.edu Previous Class What did we discuss? COMP 110 Fall 2015 2 1 Today Announcements
More informationI Internal Examination Sept Class:  BCA I Subject:  Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs.
I Internal Examination Sept. 2018 Class:  BCA I Subject:  Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs. [I]Very short answer questions (Max 40 words). (5 * 2 = 10) 1. What is
More informationLecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos.
Lecture 2: Variables and Operators AITI Nigeria Summer 2012 University of Lagos. Agenda Variables Types Naming Assignment Data Types Type casting Operators Declaring Variables in Java type name; Variables
More informationCOMP202 Unit 2: Java Basics. CONTENTS: Using Expressions and Variables Types Strings Methods
COMP202 Unit 2: Java Basics CONTENTS: Using Expressions and Variables Types Strings Methods Assignment 1 Assignment 1 posted on WebCt and course website. It is due May 18th st at 23:30 Worth 6% Part programming,
More informationComputational Expression
Computational Expression Variables, Primitive Data Types, Expressions Janyl Jumadinova 2830 January, 2019 Janyl Jumadinova Computational Expression 2830 January, 2019 1 / 17 Variables Variable is a name
More informationLecture Set 4: More About Methods and More About Operators
Lecture Set 4: More About Methods and More About Operators Methods Definitions Invocations More arithmetic operators Operator Side effects Operator Precedence Shortcircuiting main method public static
More informationChapter 2 Elementary Programming
Chapter 2 Elementary Programming Part I 1 Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from this chapter, you will learn how to solve practical
More informationCOSC 236 Section 101 Computer Science 1  Prof. Michael A. Soderstrand
COSC 236 Section 101 Computer Science 1  Prof. Michael A. Soderstrand COSC 236 Web Site I have decided to keep this site for the whole semester I still hope to have blackboard up and running, but you
More informationIs the statement sufficient? If both x and y are odd, is xy odd? 1) xy 2 < 0. Odds & Evens. Positives & Negatives. Answer: Yes, xy is odd
Is the statement sufficient? If both x and y are odd, is xy odd? Is x < 0? 1) xy 2 < 0 Positives & Negatives Answer: Yes, xy is odd Odd numbers can be represented as 2m + 1 or 2n + 1, where m and n are
More informationBasic Operations jgrasp debugger Writing Programs & Checkstyle
Basic Operations jgrasp debugger Writing Programs & Checkstyle Suppose you wanted to write a computer game to play "Rock, Paper, Scissors". How many combinations are there? Is there a tricky way to represent
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting
More informationComputer Components. Software{ User Programs. Operating System. Hardware
Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point
More informationAP Computer Science A
AP Computer Science A 1st Quarter Notes Table of Contents  section links Click on the date or topic below to jump to that section Date : 9/8/2017 Aim : Java Basics Objects and Classes Data types: Primitive
More informationAccuplacer Arithmetic Study Guide
Accuplacer Arithmetic Study Guide I. Terms Numerator: which tells how many parts you have (the number on top) Denominator: which tells how many parts in the whole (the number on the bottom) Example: parts
More informationLecture 3 Tao Wang 1
Lecture 3 Tao Wang 1 Objectives In this chapter, you will learn about: Arithmetic operations Variables and declaration statements Program input using the cin object Common programming errors C++ for Engineers
More informationObjects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003
Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 Java Programs A Java program contains at least one class definition. public class Hello { public static void
More informationA Java program contains at least one class definition.
Java Programs Identifiers Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 A Java program contains at least one class definition. public class Hello { public
More informationCSc 10200! Introduction to Computing. Lecture 23 Edgardo Molina Fall 2013 City College of New York
CSc 10200! Introduction to Computing Lecture 23 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this
More informationComputer System and programming in C
1 Basic Data Types Integral Types Integers are stored in various sizes. They can be signed or unsigned. Example Suppose an integer is represented by a byte (8 bits). Leftmost bit is sign bit. If the sign
More informationIntroduction to Programming EC105. Lecture 2
Introduction to Programming EC105 Lecture 2 Input and Output A data stream is a sequence of data  Typically in the form of characters or numbers An input stream is data for the program to use  Typically
More informationThe C++ Language. Arizona State University 1
The C++ Language CSE100 Principles of Programming with C++ (based off Chapter 2 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University
More informationCS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University
CS 112 Introduction to Computing II Wayne Snyder Department Boston University Today: Java basics: Compilation vs Interpretation Program structure Statements Values Variables Types Operators and Expressions
More informationCSE 1001 Fundamentals of Software Development 1. Identifiers, Variables, and Data Types Dr. H. Crawford Fall 2018
CSE 1001 Fundamentals of Software Development 1 Identifiers, Variables, and Data Types Dr. H. Crawford Fall 2018 Identifiers, Variables and Data Types Reserved Words Identifiers in C Variables and Values
More informationLecture 1. Types, Expressions, & Variables
Lecture 1 Types, Expressions, & Variables About Your Instructor Director: GDIAC Game Design Initiative at Cornell Teach game design (and CS 1110 in fall) 8/29/13 Overview, Types & Expressions 2 Helping
More informationage = 23 age = age + 1 data types Integers Floatingpoint numbers Strings Booleans loosely typed age = In my 20s
Intro to Python Python Getting increasingly more common Designed to have intuitive and lightweight syntax In this class, we will be using Python 3.x Python 2.x is still very popular, and the differences
More informationCMPT 125: Lecture 3 Data and Expressions
CMPT 125: Lecture 3 Data and Expressions Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 1 Character Strings A character string is an object in Java,
More informationAccelerating Information Technology Innovation
Accelerating Information Technology Innovation http://aiti.mit.edu Cali, Colombia Summer 2012 Lesson 02 Variables and Operators Agenda Variables Types Naming Assignment Data Types Type casting Operators
More informationOutline. Data and Operations. Data Types. Integral Types
Outline Data and Operations Data Types Arithmetic Operations Strings Variables Declaration Statements Named Constant Assignment Statements Intrinsic (Builtin) Functions Data and Operations Data and Operations
More informationReview: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements
Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja
More informationChapter 3 Syntax, Errors, and Debugging. Fundamentals of Java
Chapter 3 Syntax, Errors, and Debugging Objectives Construct and use numeric and string literals. Name and use variables and constants. Create arithmetic expressions. Understand the precedence of different
More informationLesson 02 Working with Data Types. MIT 31043: VISUAL PROGRAMMING By: S. Sabraz Nawaz Senior Lecturer in MIT
Lesson 02 Working with Data Types MIT 31043: VISUAL PROGRAMMING Senior Lecturer in MIT Variables A variable is a storage location in memory that is represented by a name. A variable stores data, which
More information12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started
More informationITP 342 Mobile App Dev. Code
ITP 342 Mobile App Dev Code Comments Variables Arithmetic operators Format specifiers if  else Relational operators Logical operators Constants Outline 2 Comments For a single line comment, use // The
More information16 Order of Operations
16 Order of Operations Warm Up Lesson Presentation Lesson Quiz 2 pts 3 pts Bell Quiz 16 Find each square root. 1. 25 Write all classifications that apply to each real number. 3. 55 5 pts possible Questions
More informationChapter 2: Introduction to C++
Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson AddisonWesley Education, Inc. Publishing as Pearson AddisonWesley 2.1 Parts of a C++
More informationExpressions and Casting. Data Manipulation. Simple Program 11/5/2013
Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence
More informationData and Expressions. Outline. Data and Expressions 12/18/2010. Let's explore some other fundamental programming concepts. Chapter 2 focuses on:
Data and Expressions Data and Expressions Let's explore some other fundamental programming concepts Chapter 2 focuses on: Character Strings Primitive Data The Declaration And Use Of Variables Expressions
More informationChapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, AddisonWesley Inc. Publishing as Pearson AddisonWesley
More informationCEN 414 Java Programming
CEN 414 Java Programming Instructor: H. Esin ÜNAL SPRING 2017 Slides are modified from original slides of Y. Daniel Liang WEEK 2 ELEMENTARY PROGRAMMING 2 Computing the Area of a Circle public class ComputeArea
More informationIntroduction to TURING
Introduction to TURING Comments Some code is difficult to understand, even if you understand the language it is written in. To that end, the designers of programming languages have allowed us to comment
More informationBASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I
BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment
More informationStudent Success Center Arithmetic Study Guide for the ACCUPLACER (CPT)
Fractions Terms Numerator: which tells how many parts you have (the number on top) Denominator: which tells how many parts in the whole (the number on the bottom) is parts have a dot out of Proper fraction:
More informationprintf( Please enter another number: ); scanf( %d, &num2);
CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful
More informationExpressions and Casting
Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence
More informationTwo Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types.
Class #07: Java Primitives Software Design I (CS 120): M. Allen, 13 Sep. 2018 Two Types of Types So far, we have mainly been dealing with objects, like DrawingGizmo, Window, Triangle, that are: 1. Specified
More informationChapter 2: Using Data
Chapter 2: Using Data Declaring Variables Constant Cannot be changed after a program is compiled Variable A named location in computer memory that can hold different values at different points in time
More informationLesson 02 Data Types and Statements. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL
Lesson 02 Data Types and Statements MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Topics Covered Statements Variables Data Types Arithmetic
More informationJava Notes. 10th ICSE. Saravanan Ganesh
Java Notes 10th ICSE Saravanan Ganesh 13 Java Character Set Character set is a set of valid characters that a language can recognise A character represents any letter, digit or any other sign Java uses
More informationModule 2  Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1
Module 2  Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1 Topics 1. Expressions 2. Operator precedence 3. Shorthand operators 4. Data/Type Conversion 1/15/19 CSE 1321 MODULE 2 2 Expressions
More informationArithmetic Expressions in C
Arithmetic Expressions in C Arithmetic Expressions consist of numeric literals, arithmetic operators, and numeric variables. They simplify to a single value, when evaluated. Here is an example of an arithmetic
More informationFundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials
Fundamentals We build up instructions from three types of materials Constants Expressions Fundamentals Constants are just that, they are values that don t change as our macros are executing Fundamentals
More informationComputer Programming, I. Laboratory Manual. Experiment #2. Elementary Programming
Think Twice Code Once The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2005 Khaleel I. Shaheen Computer Programming, I Laboratory Manual Experiment #2
More informationChapter 2. C++ Basics. Copyright 2014 Pearson AddisonWesley. All rights reserved.
Chapter 2 C++ Basics 1 Overview 2.1 Variables and Assignments 2.2 Input and Output 2.3 Data Types and Expressions 2.4 Simple Flow of Control 2.5 Program Style Slide 23 2.1 Variables and Assignments 2
More informationValues and Variables 1 / 30
Values and Variables 1 / 30 Values 2 / 30 Computing Computing is any purposeful activity that marries the representation of some dynamic domain with the representation of some dynamic machine that provides
More informationLESSON 2 VARIABLES, OPERATORS, EXPRESSIONS, AND USER INPUT
LESSON VARIABLES, OPERATORS, EXPRESSIONS, AND USER INPUT PROF. JOHN P. BAUGH PROFJPBAUGH@GMAIL.COM PROFJPBAUGH.COM CONTENTS INTRODUCTION... Assumptions.... Variables and Data Types..... Numeric Data Types:
More informationValues, Variables, Types & Arithmetic Expressions. Agenda
Values, Variables, Types & Arithmetic Expressions Lecture 2 ObjectOriented Programming Agenda Inside of a Computer Value Variable Data Types in Java Literals Identifiers Type conversions Manipulating
More informationBuilding Java Programs. Chapter 2: Primitive Data and Definite Loops
Building Java Programs Chapter 2: Primitive Data and Definite Loops Copyright 2008 2006 by Pearson Education 1 Lecture outline data concepts Primitive types: int, double, char (for now) Expressions: operators,
More informationChapter 2: Data and Expressions
Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University August 21, 2017 Chapter 2: Data and Expressions CS 121 1 / 51 Chapter 1 Terminology Review
More informationCIS133J. Working with Numbers in Java
CIS133J Working with Numbers in Java Contents: Using variables with integral numbers Using variables with floating point numbers How to declare integral variables How to declare floating point variables
More informationLet's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users
Introduction to PHP Let's Look Back We talked about how to create a form in HTML Forms are one way to interact with users Users can enter information into forms which can be used by you (programmer) We
More informationJAVA Programming Fundamentals
Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol
More informationFundamentals of Programming CS110. Lecture 2
Fundamentals of Programming CS110 Lecture 2 Last Lab // Example program #include using namespace std; int main() { cout
More informationJava Identifiers. Java Language Essentials. Java Keywords. Java Applications have Class. Slide Set 2: Java Essentials. Copyright 2012 R.M.
Java Language Essentials Java is Case Sensitive All Keywords are lower case White space characters are ignored Spaces, tabs, new lines Java statements must end with a semicolon ; Compound statements use
More informationChapter 2 Elementary Programming. Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved.
Chapter 2 Elementary Programming 1 Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from this chapter, you will learn how to solve practical problems
More information