CS 0004 –Lecture 3 Jan 10, 2011 Roxana Gheorghiu.

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 2 Simple C Programs.
Advertisements

Computer Programming w/ Eng. Applications
Variables and Operators
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Types, Variables and Operators Computer Engineering Department Java Course Asst. Prof. Dr. Ahmet Sayar Kocaeli University - Fall 2013.
1 9/08/06CS150 Introduction to Computer Science 1 Arithmetic Operators.
Developing Software Applications Introduction to Variables & Data Types in VB State Transition Diagrams.
Chapter 31 Fundamentals of Programming in VB(Continue I) Numbers Arithmetic Operations Variables Incrementing the Value of a Variable.
Copyright © 2001 by Wiley. All rights reserved. Chapter 3: Variables, Assignment Statements, and Arithmetic Variables Assignment Statements Arithmetic.
Variables & Math Operators CE 311 K - Introduction to Computer Methods Daene C. McKinney.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and.
Microsoft® Small Basic
CS0004: Introduction to Programming Variables – Numbers.
EG280 - CS for Engineers Chapter 2, Introduction to C Part I Topics: Program structure Constants and variables Assignment Statements Standard input and.
© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 2: Chapter 3: Slide 1 Unit 2 Variables and Calculations Chapter 3 Input,
JavaScript – Part II Data Types and Operations George Mason University June 3, 2010.
2440: 211 Interactive Web Programming Expressions & Operators.
CS0004: Introduction to Programming Variables – Strings.
Lab 01 Forms in excel Tahani ALdweesh Insert form into your project. 2. Change form’s properties. 3. Put controls on the form. 4. Change controls’
1 Do you have a CS account? Primitive types –“ building blocks ” for more complicated types Java is strongly typed –All variables in a Java program must.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
CHAPTER 4: CONTROL STRUCTURES - SEQUENCING 10/14/2014 PROBLEM SOLVING & ALGORITHM (DCT 1123)
Fundamentals of GUI Programming. Objectives: At the end of the session, you should be able to: describe the guidelines that are used for creating user-friendly.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Computer Engineering 1 st Semester Dr. Rabie A. Ramadan 3.
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
Primitive Variables.
Variables & Function Calls. Overview u Variables  Programmer Defined & Intrinsic  Data Types  Calculation issues u Using Functions  The val() function.
INT213-Week-2 Working with Variables. What is variable
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
Other Variable Types Dim lab as String makes a box that can store a label tag Dim ColHead As String ColHead = “function” ColHead function Dim lab as Boolean.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Arithmetic, Class Variables and Class Methods Week 11
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.
Variables Hold information that may be manipulated, used to manipulate other information or remembered for later use A storage location in memory (RAM)
CS Jan 2007 Chapter 2 sections 1, 2, 4 – 6, 8,
CECS 5020 Computers in Education Visual Basic Variables and Constants.
Variables Continued In the last session we saw how variables are objects that allow us to store values in the RAM of the computer In this session we shall.
CS4 –lecture 6 Wednesday, Jan 19, 2011 Roxana Gheorghiu.
Values, Types, and Variables. Values Data Information Numbers Text Pretty much anything.
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.
Introduction to Programming Python Lab 3: Arithmetic 22 January PythonLab3 lecture slides.ppt Ping Brennan
Chapter 3 – Variables and Arithmetic Operations. First Program – volume of a box /************************************************************/ /* Program.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Data Handling in Algorithms. Activity 1 Starter Task: Quickly complete the sheet 5mins!
Data and variables in Visual Basic. Annoucement Lecture on Thursday 7:30PM C106 Visual Basic download: 
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.
1 st Semester Module2 Basic C# Concept อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer Engineering.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 3 Variables and Calculations.
Making Interactive Programs with Visual Basic .NET
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are used in programs so that values can be represented with.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
Visual Basic/ Visual Studio Brandon Large. Connecting to prior knowledge In your notes write down what the two main parts of the computer are. The “software”
A variable is a name for a value stored in memory.
An Application Uses Variables to Hold Information So It May Be Manipulated, Used to Manipulate Other Information, or Remembered for Later Use.
Visual Basic Variables
Introduction to Programming
Revision Lecture
Variables and Arithmetic Operations
Numbers.
Introduction to Programming
Engineering Problem Solving with C++ An Object Based Approach
Engineering Problem Solving with C++ An Object Based Approach
C Programming Lecture-3 Keywords, Datatypes, Constants & Variables
Presentation transcript:

CS 0004 –Lecture 3 Jan 10, 2011 Roxana Gheorghiu

 Controls (components) = building block of a GUI ◦ Labels ◦ Textboxes ◦ Buttons ◦ Check boxes ◦ Radio buttons  Variables = identifiers used in a program to hold some data ◦ Algebra: x=5; y=x*x; ◦ VBA:  Dim x as Integer  Dim y as Integer  x =5  y =2*x VBA Controls and Variables

Each type is design to store a particular type of data Possible data types: Integer: -1000, 10, 0, Double: -10.5, 0.0, String : “ this is a string”, “anotherOne” Date … 2-phase process Declaration Assignment of value (usage) Variable Types

Create the container Declarations Phase that creates a variable Dim varName as Type Dim name as String or Dim x as Integer or … Rules for variable names: Can only use letters, numbers and underscore (_) Must start with a letter or underscore Cannot have spaces Cannot use special characters Cannot be a keyword Price As Integer

Fill the container Assignment of value =gives the variable a value By assigning a value myName =“Roxana”; shoesPrice =30 By assigning a value from another variable newAddress =oldAddress By using arithmetic operations Price As Integer

Fill the container Assignment of value =gives the variable a value By assigning a value myName =“Roxana”; shoesPrice =30 By assigning a value from another variable newAddress =oldAddress By using arithmetic operations

 Addition: + ◦ x = 5+5; x=y+5  Subtraction: - ◦ x = ; myBudget =mySalary  Division: / ◦ z = X/2  Multiplication: * ◦ x = 10*y ◦ y = 2*5;  Exponentiation: ^ ◦ y = x^2 ◦ z = 2^3 Arithmetic operations

Incrementing Numbers Dim x as Integer x =x+1ORx+ =1 Decrementing Numbers Dim y as Integer y=y-1ORy-=1 Arithmetic Shorthand

Rounding Math.Round(number, precision) Math.Round(2.182, 1) =2.2 Math.Round(2.182) =2.0 Modulo =the reminder after you divide the two numbers 5 Mod 3 =2 21 Mod 2 =1 Square Root Math.Sqrt(9) More Arithmetic Operations

Compute the perimeter Write a program that : Allows a user to give two values: length and width reads the values of length and the width computes the perimeter when Calc button is pressed. displays this value on the screen. exits when Exit button is pressed