Programming Fundamentals

Slides:



Advertisements
Similar presentations
For(int i = 1; i
Advertisements

Path planning error in game Battle for Middle Earth (LOTR) City wall Too big creatures try to move too big things Turning around, walking through wall.
By Senem Kumova Metin 1 POINTERS + ARRAYS + STRINGS REVIEW.
Introduction to Primitives. Overview Today we will discuss: –The eight primitive types, especially int and double –Declaring the types of variables –Operations.
Constants Variables change, constants don't final = ; final double PI = ; … area = radius * radius * PI; see Liang, p. 32 for full code.
Switch Statement switch (month) { case 9: case 4: case 6: case 11: days = 30; break; case 2: days = 28; if (year % 4 == 0) days = 29; break; default: days.
Object References. Objects An array is a collection of values, all of the same type An object is a collection of values, which may be of different types.
1 Key Concepts:  Data types in C.  What is a variable?  Variable Declaration  Variable Initialization  Printf()  Scanf()  Working with numbers in.
COMP 14: Primitive Data and Objects May 24, 2000 Nick Vallidis.
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:
Week 2 - Monday.  What did we talk about last time?  Software development  Lab 1.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 4: Continuing with C++ I/O Basics.
1 Please switch off your mobile phones. 2 Data Representation Instructor: Mainak Chaudhuri
Java Data Types Data types, variable declaration, and initialization.
Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.
1 Pointers and Arrays. 2 When an array is declared,  The compiler allocates sufficient amount of storage to contain all the elements of the array in.
Primitive Variables.
A Revamping Of our skills so far. Our Tools so Far Variable - a placeholder for a value Method - a set of code which accomplishes a task Class - a mold.
12-CRS-0106 REVISED 8 FEB 2013 CSG2H3 Object Oriented Programming.
Variables, Primitives, and Objects A Visual Learner’s Guide.
Data Types and Operations On Data Objective To understand what data types are The need to study data types To differentiate between primitive types and.
Electricity and Magnetism
Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off.
Variables in Java x = 3;. What is a variable?  A variable is a placeholder in memory used by programmers to store information for a certain amount of.
Objective: Students will be able to: Declare and use variables Input integers.
Data Tonga Institute of Higher Education. Variables Programs need to remember values.  Example: A program that keeps track of sales needs to remember.
Arrays: Part Opening Discussion zWhat did we talk about last class? zWhat do you think the picture of memory looks like when we declare.
Memory Management in Java Computer Science 3 Gerb Objective: Understand references to composite types in Java.
Side effects A side effect is anything that happens in a method other than computing and/or returning a value. Example: public class hello { public int.
Digesting a big problem ONE BYTE AT A TIME. Quiz YOU WILL WORK WITH YOUR PARTNER (LAB PARTNER NOT FULL TEAM). FOR SOLOISTS OR THOSE WHOSE PARTNER IS NOT.
Pointers in C++. Topics Covered  Introduction to Pointers  Pointers and arrays  Character Pointers, Arrays and Strings  Examples.
Data and Data Types PROGRAMMING FUNDAMENTALS. Your textbook Textbook scavenger hunt.
Values, Types, and Variables. Values Data Information Numbers Text Pretty much anything.
Sum of Arithmetic Sequences. Definitions Sequence Series.
Goal: To explain the difference between diffusion and active transport in order understand why these are necessary for absorption of nutrients. Sci7: Tu.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Copyright © Texas Education Agency, Computer Programming Variables and Data Types.
Discussion 4 eecs 183 Hannah Westra.
Week 2 - Wednesday CS 121.
CST 1101 Problem Solving Using Computers
2.0 FUNDAMENTALS OF JAVA PROGRAMMING LANGUAGE
Variables, Printing and if-statements
Type Conversion, Constants, and the String Object
Fundamentals of Economics
Basic notes on pointers in C
I CAN solve equations using the Quadratic Formula. lesson 9.4a.
Unit 6 - Variables - Fundamental Data Types
Cs212: Data Structures Computer Science Department Lecture 2: Arrays.
Statements and expressions - java
Binary Numbers.
CS 200 Arrays Jim Williams, PhD.
Hope that makes a BIG change in YOU
Seating “chart” Front Back 4 rows 5 rows 5 rows 4 rows 2 rows 2 rows
Introduction to Primitives
Introduction to Primitives
C Programming Pointers
CS2911 Week 2, Class 3 Today Return Lab 2 and Quiz 1
Variables and Computer Memory
Names of variables, functions, classes
Hope that makes a BIG change in YOU
When you leave office today.
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Hope that makes a BIG change in YOU
Variables and Constants
Hope that makes a BIG change in YOU
When you leave office today.
Array Fundamentals A simple example program will serve to introduce arrays. This program, REPLAY, creates an array of four integers representing the ages.
LET’S PLAY JEOPARDY!!.
Python fundamental.
Presentation transcript:

Programming Fundamentals Data and Data Types Programming Fundamentals

Today’s activity A “container” is a named location in memory. When we said: String message; we were building a container in memory that would hold String sized values. int number; builds an int sized container to hold integers.

Examples If we build an int container using the declaration, int sum; the container can only hold ints or anything smaller.

An int container can hold: int sum; sum 25 192 2,647,189 2,147,483,647 An int container cannot hold: These values are too “big” or incompatible with an int. 25.158 << too big as how it is represented 2,147,483,650 << too big “something” << incompatible true << incompatible

An int container can hold anything smaller: int sum; byte number; number = (byte) 125; sum number 125 number sum 125 sum = number; 125 sum But we can’t go the other way around. 125 number number = sum;

Worksheet Spend a few minutes with your team working through the worksheet. Turn the GROUP response into the folder. The lab will have you practice with what happens as you assign values to different kinds of containers.