Data and Operations. Outline
|
|
- Lillian Hunter
- 5 years ago
- Views:
Transcription
1 Data and Operations Data and Operations 1 Outline Data Types Arithmetic Operations Strings Variables Declaration Statements Named Constant Assignment Statements Intrinsic (Built-in) Functions Data and Operations 2
2 Data Types In computers data such as integers, real numbers, character, strings, and Boolean are represented and stored in memory differently. In order to represent data efficiently based on memory space and calculations accuracy, the size memory space is preset for each data type to be stored. Computer languages provide appropriate different data types according to the size of storage. There are four fundamental data types: Integral types Floating-point numbers Characters String Boolean values Data and Operations 3 Integral Data Types An integer type has a value as a whole number either negative or positive, e.g., 123, +123, 123, Visual Basic.NET has different integral types depends on the size of the storage. For examples, Byte -- 1 byte Short -- 2 bytes Integer -- 4 bytes Long -- 8 bytes Data and Operations 4
3 Integer Data Types For values that will always be a whole number Usually name a variable starting with a 3 or 4 letter prefix indicating the variable s type Data Type Namin g Prefix Description Byte byt Unsigned integer from 0 to 255 Short shrt Signed integer from -32,768 to 32,767 Intege r Long int Signed integer from -2,147,483,648 to 2,147,483,647 lng Signed integer from - 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 Data and Operations 5 Floating-Point Data Types For values that may have fractional parts Single used most frequently Double sometimes used in scientific calculations Decimal often used in financial calculations Data Type Namin g Prefix Description Single sng As large as plus or minus, 7 decimal positions Double dbl As large as plus or minus,15 decimal positions Decima l dec As large as plus or minus, 29 decimal positions Data and Operations 6
4 Floating-Point Data Types A floating number or a real number is any signed or unsigned number having an integer part and a fractional part, with a decimal point in between e.g., 18.0, +9.2, 35.25, 0.57, 138.2, 4.,.8 Visual Basic supports two different categories of floating point numbers: Single -- Numbers which are stored using the single data type are called single precision numbers. Double -- Numbers that are stored using the double data type are called double precision numbers. A double precision number uses twice the amount of storage as that used by a single precision number. Data and Operations 7 Exponential Notation Exponential notation is commonly used to express both very large and very small floating point numbers in a compact form, e.g., E 12, E4, 7E20 It is similar to scientific notation. Decimal Notation Exponential Notation Scientific Notation E E E E Data and Operations 8
5 Other Common Data Types Boolean variable naming prefix is bln Holds 2 possible values, True or False Char variable naming prefix is chr Holds a single character Allows for characters from other languages String variable naming prefix is str Holds a sequence of up to 2 billion characters Date variable naming prefix is dat Can hold date and/or time information Data and Operations 9 Strings A string consists of one or more characters that are enclosed within double quotes. The number of characters within a string determines the length of the string. For examples, apple, S, 45, Joe Nobody and HELLO. String concatenation means the joining of two or more strings into a single string. Visual Basic provides two symbols, the ampersand (&) and the plus sign (+), for performing string concatenation. Joe & & Nobody Joe Nobody Numeric values and/or strings can be displayed using either a call to the MessageBox.Show() method or a text box. Data and Operations 10
6 ASCII Code A N B O C P D Q E R F S G T H U I V J W J o e K X L Y M Z Data and Operations 11 Boolean There are only two Boolean data values in Visual Basic. These values are the constants: True and False. The Boolean constants are used in decision-making statements. Data and Operations 12
7 Date Data Type Date data type variables can hold the date and time A date literal is enclosed within # symbols #10/20/2005 6:30:00 AM# or #12/10/2005# or #21:15:02# Or can use a function to convert a string to a date System.Convert.ToDateTime("12/3/2002") System.Convert.ToDateTime function is used to store a date from a text box in a date variable System.Convert.ToDateTime(txtDate.text) Data and Operations 13 Fundamental VB.NET Data Types Type Size in Bytes Description Range of Values Byte 1 8-bit unsigned integer Integer 4 32-bit signed integer Long 8 64-bit signed integer Short 2 16-bit signed integer 32,768-32,767 Single 4 Double 8 Decimal 16 Char 2 32-bit floating point variable 64-bit floating point variable 128-bit floating point variables 16-bit Unicode characters String Varies Non-Numeric Type 3.4E38-3.4E+38 (7 significant digits) 1.7E E+308 (15 significant digits) 0-65,535 Boolean 1 Non-Numeric Type False or True Date 8 Non-Numeric Type 00:00:00 on January 1, :59:59 on December 31, 9999 Object 4 Non-Numeric Type Reference to an object Data and Operations 14
8 Arithmetic Operations Visual Basic provides a number of numeric operators, which can be used to perform operations such as additions, subtractions, multiplications, etc. A simple numeric expression is an expression that has a numeric operator connecting two arithmetic operands. This type of expression has the syntax: operand operator operand A binary operator is an operator that requires two operands. A unary operator is an operator that requires only one operand. Data and Operations 15 Arithmetic Operations + Unary Plus Unary Negation + Addition Subtraction * Multiplication / Division \ Integer Division ^ Mod Exponentiation Modulus -- return remainder Data and Operations 16
9 Precedence of Arithmetic Operations Operator ^ Exponentiation Negation Operation * / Multiplication and Division \ Integer Division Mod Modulus -- return remainder + Addition and Subtraction Data and Operations 17 Operator Precedence Examples 6 * 2^3 + 4 / 2 6 * / / / 2 * 2^ / 2 * * Data and Operations 18
10 Rules of Forming Expressions The followings are rules when writing expressions in Visual Basic: Two binary operators must never be placed adjacent to one another. 20 * 40 is invalid. Parentheses may be used to form groupings, and all expressions enclosed within parentheses are evaluated first. Parentheses cannot be used to indicate multiplication. ( ) (30) is invalid. Data and Operations 19 Expression Types Integer expression -- is an arithmetic expression containing only integers. Floating point expression -- is an arithmetic expression containing only floating point numbers. Mixed-mode expression -- is an arithmetic expression containing both integers and floating point numbers. Data and Operations 20
11 Types of Arithmetic Expressions combining floating point numbers with either integers or floating point numbers floating point combining integers or floating point numbers with \ integer combining integers with either +,, *,\, Mod integer Data and Operations 21 Arithmetic Expression Expression Result Type Integer 11 / 4.6 * Floating Point 11 / (4.6 * 0.879) Floating Point * Floating Point Data and Operations 22
12 Integer Division Operator VB.NET uses back slash (\) as integer division operator. Expression Actual Value Result 11\4 11\4 = \4.6 11\5 = \4 11\4 = \4.6 11\5 = Data and Operations 23 Mod Operator The modulus operator Mod yields the remainder of the result of dividing its first operand by its second. Expression Actual Value Result 11 Mod = 2 r Mod = 5 r Mod = 2 r Mod = 2 r Data and Operations 24
13 Variables A variable is a storage location in the computer s memory, used for holding information while the program is running. The information that is stored in a variable may change, hence the name variable. Data and Operations 25 What Can You Do With Variables? Copy and store values entered by the user, so they may be manipulated Perform arithmetic on values Test values to determine that they meet some criterion Temporarily hold and manipulate the value of a control property Remember information for later use in the program Data and Operations 26
14 How to Think About Variables You the programmer make up a name for the variable Visual Basic associates that name with a location in the computer's RAM The value currently associated with the variable is stored in that memory location Data and Operations 27 Variable Naming Rules The first character of a variable name must be a letter or an underscore Subsequent characters may be a letter, underscore, or digit Thus variable names cannot contain spaces or periods (or many other kinds of characters) Visual Basic keywords cannot be used as variable names Data and Operations 28
15 Variable Naming Conventions Naming conventions are a guideline to help improve readability but not required syntax A variable name should be chosen to indicate what it represents Each data type has a recommended prefix, in lower case, that begins the variable name The 1 st letter of each subsequent word in the variable name should be capitalized inthoursworked - an integer variable strlastname - a string (or text) variable Data and Operations 29 Declaring Variables with IntelliSense As you enter your program, VB often aids you by offering a list of choices that could be used at that point After typing As in a variable declaration, VB will offer an alphabetical list of all possible data types Type the first few letters of the data type name Intellisense box will highlight the matching type Press the Tab key to select highlighted choice Or just complete typing the entire data type name Data and Operations 30
16 Variable Declaration Statements A variable declaration is a statement that create a variable in memory as well as specifying the data type that can be stored in it. Declaration statements placed within a procedure and have the general syntax: Dim VariableName As DataType Dim (short for Dimension) is a keyword ariablename is the programmer designated name As is a keyword DataType is one of many possible keywords for the type of value the variable will contain Data and Operations 31 Examples Dim intnumber As Integer Dim sngwages As Single Dim strlast_name As String Dim chrmiddleintial As Char Dim blnempty As Boolean Data and Operations 32
17 Single-line line Declarations Visual Basic allows combining multiple declarations into one statement, using the syntax: Dim var1 As DataType, var2 As DataType,...,,...,varn As DataType Examples: Dim strfirstname As String, strlastname As data-type, strmiddleinit As Char, inttest1 As Integer, inttest2 As Integer, sngaverage As Single Dim inttest1, inttest2, inttest3, intfianlexam As Integer, sngaverage As Single Data and Operations 33 Default Values When a variable is first created in memory, it is assigned a default value numeric types are given a value of zero Boolean types are given a value of False strings are given a value of Nothing dates default to 12:00:00 AM January 1,1 Data and Operations 34
18 Initialization An initialization is the process of storing a value in a variable for the first time. Declaration statements perform both a software and a hardware function. From a software perspective, declaration statements provide a convenient, up-front list of all variables and their data types. The hardware function that declaration statements perform is that they inform Visual Basic of the physical memory storage that must be reserved for each variable. Programmers use variable names to reference their contents. Data and Operations 35 Initialization Can provide a starting or initialization value for any type of variable in a Dim statement Usually want to set an initial value unless assigning a value prior to using the variable Just append = value to the Dim statement where value is the literal to be assigned to the variable Dim intmonthsperyear As Integer = 12 Good practice to initialize string variables Dim strname As String = String.Empty String with value Nothing causes error if used Data and Operations 36
19 Scope and Local Variables Scope refers to the part of the program where: A variable is visible and May be accessed by program code Variables declared within a procedure are called local variables and observe these characteristics Scope begins where variable is declared Extends to end of procedure where declared Variable is not visible outside the procedure A variable cannot be declared twice in the same procedure Data and Operations 37 Class-Level and Global Scope A variable declared inside a class but outside any procedure is a class-level variable Scope is throughout all procedures of the class A variable declared outside any class or procedure is a global variable Scope is throughout all forms, classes, and procedures of the project Class-level and global scope will be discussed further in future chapters Values in a variable are destroyed when it goes out of scope Data and Operations 38
20 Named Constants Programs often need to use given values For example: dectotal *= dectotal* 1.06 Adds 6% sales tax to an order total Two problems with this approach The reason for multiplying dectotal by 1.06 isn t always obvious If sales tax rate changes, must find and change every occurrence of.06 or 1.06 Use of named constants resolves both these issues Data and Operations 39 Named Constants Constants are numbers that have a special meaning in the context of a particular application. Const statement is used to assign symbolic names to constants. The syntax for this statement within a form s procedure is: Const named-constant As DataType = expression A named constant is a symbolic name assigned to a constant. A named constant cannot be altered after it is defined. All Const statements must be placed in the Declarations section of the form or within a procedure, but for clarity they are usually placed immediately after the procedure s declaration Data and Operations 40
21 Named Constants Can declare a variable whose value is set at declaration and cannot be changed later: Const sngsales_tax_rate As Single = 1.06 The objective of our code is now clearer Const sngsales_tax_rate As Single = 1.06 dectotal *= sngsales_tax_rate Data and Operations 41 Examples Const bythourlyrate As Byte = 15 Const bytweekly As Byte = 40 Const sngpi As Single = Const dblsalestax As Double =.0825 Data and Operations 42
22 Assignment Statements Assignment statements are statements that tell the computer to store a value into a variable. An assignment statement can be used to both assign a value to a variable and to perform calculations. The assignment statement has the following syntax: variable = expression An expression is any combination of constants, variables, and operators that can be evaluated to yield a value. Assignment statements always have an equal (=) sign and exactly one variable name immediately to the left of the equal sign. The value on the right of the equal sign is assigned to the variable on the left of the equal sign. Data and Operations 43 Examples Count = 0 Count = Count + 1 Sum = Sum + Data Area = Height * Width AverageScore = TotalSum / NemberOfScores Solution = Math.Sqrt(B^2 2*A*C) Data and Operations 44
23 Assignment Statements Data location: Data location: Consider following actions that a computer will perform: put 65 in location put 49 in location Add the content of location to the content of location store the sum in location The programming version is as follows: Data1 = 65 Data2 = 49 Sum = Data1 + Data2 0 Sum location: Data and Operations 45 Assignment Variations An assignment variation statement is an assignment statement in which the variable on the left of the equal sign is also used on the right of the equal sign. For example : Total = Total Sum = Sum + Number Data and Operations 46
24 Accumulating To accumulate subtotals when data is entered one number at a time, assignment statements such as Total = Total are used. These statements have the syntax: variable = variable + new value Example: SumScore = SumScore + Score Data and Operations 47 Counting The counting statement is a variation of the accumulating assignment statement. It has the following form: Variable = Variable + fixed number After a counting statement is executed, the value of the variable is increased by a fixed amount. Example: Count = Count + 1 Count += 1 Data and Operations 48
25 Lab 6 Task 2 Const SalesTaxRate As Single = Dim TotalAmount, SalesTaxAmount, InputAmount As Double REM Retrieve input amount from InputAmountTextBox and REM Compute the sales tax, then the total amount InputAmount = InputTextBox.Text SalesTaxAmount = InputAmount * SalesTaxRate TotalAmount = InputAmount + SalesTaxAmount REM Display sales tax and total amount SalesTaxLabel.Text = FormatCurrency(SalesTaxAmount) TotalAmountLabel.Text = FormatCurrency(TotalAmount) Data and Operations 49 Lab 6 Task 2 Const SalesTaxRate As Single = SalesTaxRate Dim TotalAmount, SalesTaxAmount, InputAmount As Double REM Retrieve input amount from InputAmountTextBox and REM Compute the sales tax, then the total amount InputAmount = InputTextBox.Text SalesTaxAmount = InputAmount * SalesTaxRate TotalAmount = InputAmount + SalesTaxAmount REM Display sales tax and total amount SalesTaxLabel.Text = FormatCurrency(SalesTaxAmount) TotalAmountLabel.Text = FormatCurrency(TotalAmount) Data and Operations 50
26 Lab 6 Task 2 Const SalesTaxRate As Single = Dim TotalAmount, SalesTaxAmount, InputAmount As Double REM Retrieve input amount from InputAmountTextBox and REM Compute the sales tax, then the total amount InputAmount = InputTextBox.Text SalesTaxAmount = InputAmount * SalesTaxRate TotalAmount = InputAmount + SalesTaxAmount REM Display sales tax and total amount SalesTaxLabel.Text = FormatCurrency(SalesTaxAmount) TotalAmountLabel.Text = FormatCurrency(TotalAmount) SalesTaxRate TotalAmount 0. SalesTaxAmount 0. InputAmount 0. Data and Operations 51 Lab 6 Task 2 Const SalesTaxRate As Single = Dim TotalAmount, SalesTaxAmount, InputAmount As Double REM Retrieve input amount from InputAmountTextBox and REM Compute the sales tax, then the total amount InputAmount = InputTextBox.Text SalesTaxAmount = InputAmount * SalesTaxRate TotalAmount = InputAmount + SalesTaxAmount REM Display sales tax and total amount SalesTaxLabel.Text = FormatCurrency(SalesTaxAmount) TotalAmountLabel.Text = FormatCurrency(TotalAmount) SalesTaxRate TotalAmount 0. SalesTaxAmount 0. InputAmount 100. Data and Operations 52
27 Lab 6 Task 2 Const SalesTaxRate As Single = Dim TotalAmount, SalesTaxAmount, InputAmount As Double REM Retrieve input amount from InputAmountTextBox and REM Compute the sales tax, then the total amount InputAmount = InputTextBox.Text SalesTaxAmount = InputAmount * SalesTaxRate TotalAmount = InputAmount + SalesTaxAmount REM Display sales tax and total amount SalesTaxLabel.Text = FormatCurrency(SalesTaxAmount) TotalAmountLabel.Text = FormatCurrency(TotalAmount) SalesTaxRate TotalAmount 0. SalesTaxAmount 8.25 InputAmount 100. Data and Operations 53 Lab 6 Task 2 Const SalesTaxRate As Single = Dim TotalAmount, SalesTaxAmount, InputAmount As Double REM Retrieve input amount from InputAmountTextBox and REM Compute the sales tax, then the total amount InputAmount = InputTextBox.Text SalesTaxAmount = InputAmount * SalesTaxRate TotalAmount = InputAmount + SalesTaxAmount REM Display sales tax and total amount SalesTaxLabel.Text = FormatCurrency(SalesTaxAmount) TotalAmountLabel.Text = FormatCurrency(TotalAmount) SalesTaxRate TotalAmount SalesTaxAmount 8.25 InputAmount 100. Data and Operations 54
28 Lab 6 Task 2 Const SalesTaxRate As Single = Dim TotalAmount, SalesTaxAmount, InputAmount As Double REM Retrieve input amount from InputAmountTextBox and REM Compute the sales tax, then the total amount InputAmount = InputTextBox.Text SalesTaxAmount = InputAmount * SalesTaxRate TotalAmount = InputAmount + SalesTaxAmount REM Display sales tax and total amount SalesTaxLabel.Text = FormatCurrency(SalesTaxAmount) TotalAmountLabel.Text = FormatCurrency(TotalAmount) SalesTaxRate TotalAmount SalesTaxAmount 8.25 InputAmount 100. Data and Operations 55 Lab 6 Task 2 Const SalesTaxRate As Single = Dim TotalAmount, SalesTaxAmount, InputAmount As Double REM Retrieve input amount from InputAmountTextBox and REM Compute the sales tax, then the total amount InputAmount = InputTextBox.Text SalesTaxAmount = InputAmount * SalesTaxRate TotalAmount = InputAmount + SalesTaxAmount REM Display sales tax and total amount SalesTaxLabel.Text = FormatCurrency(SalesTaxAmount) TotalAmountLabel.Text = FormatCurrency(TotalAmount) SalesTaxRate TotalAmount SalesTaxAmount 8.25 InputAmount 100. Data and Operations 56
29 Implicit Type Conversions A value of one data type can be assigned to a variable of a different type An implicit type conversion is an attempt to convert to the receiving variable s data type A widening conversion suffers no loss of data Converting an integer to a single Dim sngnumber as Single = 5 A narrowing conversion may lose data Converting a decimal to an integer Dim intcount = 12.2 intcount becomes 12 Data and Operations 57 Option Strict Option Strict is a VB configuration setting Only widening conversions are allowed when Option Strict is set to On An integer can be assigned to a decimal A decimal cannot be assigned to an integer A single can be assigned to a double A double cannot be assigned to a single Option Strict On is recommended to help catch errors Data and Operations 58
30 Type Conversion Runtime Errors Consider the statement Dim intcount As Integer = abc123 This is a narrowing conversion With Option Strict On, statement will not compile With Option Strict Off, statement compiles but String abc123 will not convert to an integer A runtime error called a type mismatch occurs when this statement is executed Data and Operations 59 Explicit Type Conversions A function performs some predetermined operation and provides a single output Input(s) Function Output VB provides a set of functions that permit narrowing conversions with Option Strict On These functions will accept a constant, variable name, or arithmetic expression The function returns the converted value Data and Operations 60
31 Explicit Type Conversions The following narrowing conversions require an explicit type conversion Double to Single Single to Integer Long to Integer Boolean, Date, Object, String, and numeric types represent different sorts of values and require conversion functions as well Data and Operations 61 Explicit Type Conversion Examples Rounding can be done with the CInt function intcount = CInt(12.4) intcount value is 12 intcount = CInt(12.5) intcount value is 12 CStr converts an integer value to a string Dim strtext as String = CStr(26) CDec converts a string to a decimal value Dim decpay as Decimal = CDec( $1,500 ) CDate converts a string to a date Dim dathired as Date = CDate( 05/10/2005 ) Data and Operations 62
32 A Full List of Conversion Functions There are conversion functions for each data type CBool ( expr ) CByte ( expr ) CChar ( expr ) CDate ( expr ) CDbl ( expr ) CDec ( expr ) CInt ( expr ) CLng ( expr ) CObj ( expr ) CShort ( expr ) CSng ( expr ) CStr ( expr ) Data and Operations 63 Invalid Conversions Conversion functions can fail Dim dblsalary As Double = CDbl( xyz ) Dim dathired As Date = CDate( 05/35/2005 ) String xyz can t be converted to a number There s no day 35 in the month of May These failed conversions cause a runtime error called an invalid cast exception Data and Operations 64
33 The Val Function The Val function is a more forgiving means of performing string to numeric conversions Uses the form Val(string) as shown here intnumber = 45 Return value is the number 45 Argument contains the string 45 Val(InputTextBox.text) If the initial characters form a numeric value, the Val function will return that Otherwise, it will return a value of zero Data and Operations 65 The Val Function Val Function Value Returned Val("34.90 ) 34.9 Val("86abc ) 86 Val("$24.95 ) 0 Val("3,789 ) 3 Val(" ) 0 Val("x29 ) 0 Val("47% ) 47 Val("Geraldine ) 0 Data and Operations 66
34 Examples Expression Dim intaverage As Integer Average = 98 / 10 Dim intnumberstring As Integer NumberString = 100 Dim sngnumber As Single Number = 100 Assigned Value intaverage = 10 intnumberstring = 100 sngnumber = Data and Operations 67 Asc(string) Chr(val) Function Name and Arguments CBool(expression) CByte(expression) CChar(expression) CDate(expression) CDbl(expression) CDec(expression) CInt(expression) CLng(expression) CObj(expression) CShort(expression) CSng(expression) CStr(expression) CType(expression, type) Val(string) with VB.NET Description and Returned Value Convert the first character in the string to an ACII value Returns string associated with the specified ASCII value. Convert an expression to a Boolean value. Convert an expression to a Byte with rounding if necessary. Convert the first character of a string expression to a Char Convert an expression to a date. Convert a numeric value or string expression to a Double. Convert a numeric value or string expression to a Decimal. Convert a numeric value or string expression to a Integer. Convert a numeric value or string expression to a Long. Convert an expression to an Object. Convert a numeric value or sting expression to a Short. Convert a numeric value or sting expression to a Single. Convert an expression to a String. Convert an expression to a specified type. Return the first numeric value of the string. Data and Operations 68
35 Intrinsic (Built-in) in) Functions Intrinsic functions are preprogrammed routines provided by Visual Basic.NET that can be used in a procedure. These include mathematical functions, functions to carry out conversion between data types, formatting functions, and string manipulation functions. A number of mathematical functions are found in the System.Math class of Visual Basic.NET. Functions operate in a manner similar to sub procedures, except for the fact that a function always directly returns a single value. Data and Operations 69 Examples Function Name Description Returned Value Math.Sqrt(9) Square root 3 Math.Abs(-42) Absolute value 42 Math.Round(4.779, 2) Round 4.78 Math.Log(24.212) Log Data and Operations 70
36 Examples Function Name Description Returned Value Val( 100 ) Convert string to value 100 CStr(100) Convert value to string 100 Int(99.8) Round to nearest integer less than or equal to the number 99 CInt(99.8) Round to nearest integer 100 Ceiling(99.8) Floor(99.8) Returns the smallest integer greater than the number Returns the integer largest less than the number Data and Operations 71 Problem Create a project that can be used by a business persons on their laptop computer to determine exchange rates for China, Japan, England, and France. A form for this project is shown on the right. For this project, assume that one dollar has 8.3 yuans 120 yen 0.6 pounds 5 francs Data and Operations 72
37 Objects and Their Properties Control Name Text ForeColo r Font Size Others Form1 Default Currency Conversion Default None Size: 470, 315 Textbox1 InputTextBox None (blank) Default 12 Size: Width: 100 Label1 DisplayLabel None (blank) Red 12 Label2 Defualt Enter the dollar amount in text1 and click on the appropriate button. Default 12 Size: 100, 30, BackColor: Pale Yellow Size: 400, 40 Label3 Defualt Enter The Dollar Amount: Default 12 Size: 200, 30 Label4 CurrencyLabe l Currency: Default 12 Size: 80, 30, Button1 YenButton Yen Blue 12 Size: 100, 30; Bold: True Button2 YuanButton Yuans Blue 12 Size: 100, 30; Bold: True Button3 PoundButton Pounds Blue 12 Size: 100, 30; Bold: True Button4 FrancButton Francs Blue 12 Size: 100, 30; Bold: True Button5 QuitButton Quit Red 12 Size: 100, 30; Bold: True Data and Operations 73 Form Design Data and Operations 74
38 How Many Events Are in This Project? 1. YenButton Click Event Convert dollars to Yen Display currency as Yen 2. YuanButton Click Event Convert dollars to Yuans Display currency as Yuans 3. PoundButton Click Event Convert dollars to Pounds Display currency as Pounds 4. FrancButton Click Event Convert dollars to Francs Display currency as Francs 5. QuitButton Click Event Close application/window Data and Operations 75 Chart of Functions for Each Control Currency Conversion Application Yen Button Click Event: Convert dollars to Yen Display currency as Yen Yuan Button Click Event: Convert dollars to Yuans Display currency as Yuans Pound Button Click Event: Convert dollars to Pounds Display currency as Pounds Franc Button Click Event: Convert dollars to Francs Display currency as Franc Quit Button Click Event: Close application/window Data and Operations 76
39 Code for Each Event Procedure 1. YenButton Click Event Procedure: Dim Amount As Double Amount = Val(InputTextbox.Text) Convert dollars to Yen DisplayLabel.Text = Amount * Display currency as Yen CurrencyLabel.Text = "Yen" 2. YuanButton Click Event Convert dollars to Yuans DisplayLabel.Text = Val(InputTextbox.Text) * 8.3 Display currency as Yuans CurrencyLabel.Text = "Yuans" 3. PoundButton Click Event Convert dollars to Pounds DisplayLabel.Text = Val(InputTextbox.Text) * 8.3 Display currency as Pounds CurrencyLabel.Text = "Yuans" 4. FrancButton Click Event Convert dollars to Francs DisplayLabel.Text = Val(InputTextbox.Text) * 8.3 Display currency as Francs CurrencyLabel.Text = "Yuans" 5. QuitButton Click Event Close application/window Close() Data and Operations 77 Data and Operations 78
Data Types. Strings Variables Declaration Statements Named Constant Assignment Statements Intrinsic (Built-in) Functions
Data and Operations Outline Data Types Arithmetic Operations Strings Variables Declaration Statements Named Constant Assignment Statements Intrinsic (Built-in) Functions Data and Operations 1 Data and
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 (Built-in) Functions Data and Operations Data and Operations
More information3.1. Chapter. CSC 252 (MIS 385) Chapter 3 Input, Variables, Exceptions, and Calculations. Introduction. Page 1
Chapter 3 Input, Variables, Constants, And Calculations Slide 3-1 Introduction This chapter covers the use of text boxes to gather input from users It also discusses the use of variables named constants
More informationProgramming Language 2 (PL2)
Programming Language 2 (PL2) 337.1.1 - Explain rules for constructing various variable types of language 337.1.2 Identify the use of arithmetical and logical operators 337.1.3 Explain the rules of language
More informationCopyright 2014 Pearson Education, Inc. Chapter 3. Variables and Calculations. Copyright 2014 Pearson Education, Inc.
Chapter 3 Variables and Calculations Topics 3.1 Gathering Text Input 3.2 Variables and Data Types 3.3 Performing Calculations 3.4 Mixing Different Data Types 3.5 Formatting Numbers and Dates 3.6 Class-Level
More informationChapter 3. Variables and Calculations Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of
Chapter 3 Variables and Calculations Addison Wesley is an imprint of 2011 Pearson Addison-Wesley. All rights reserved. Section 3.1 GATHERING TEXT INPUT In this section, we use the TextBox control to gather
More informationUnit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types
Managing Data Unit 4 Managing Data Introduction Lesson 4.1 Data types We come across many types of information and data in our daily life. For example, we need to handle data such as name, address, money,
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 informationIntroduction to Data Entry and Data Types
212 Chapter 4 Variables and Arithmetic Operations STEP 1 With the Toolbox visible (see Figure 4-21), click the Toolbox Close button. The Toolbox closes and the work area expands in size.to reshow the Toolbox
More informationAgenda & Reading. VB.NET Programming. Data Types. COMPSCI 280 S1 Applications Programming. Programming Fundamentals
Agenda & Reading COMPSCI 80 S Applications Programming Programming Fundamentals Data s Agenda: Data s Value s Reference s Constants Literals Enumerations Conversions Implicitly Explicitly Boxing and unboxing
More informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
More informationCSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York
CSc 10200! Introduction to Computing Lecture 2-3 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 informationMurach s Visual Basic 2012, C4 2013, Mike Murach & Associates, Inc. Slide 1. The built-in value types (continued)
The built-in value types Keyword Bytes Type Description Byte 1 Byte Positive integer value from 0 to 255 SByte 1 SByte Signed integer value from -128 to 127 Short 2 Int16 Integer from 32,768 to +32,767
More informationVARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals
VARIABLES WHAT IS A VARIABLE? A variable is a storage location in the computer s memory, used for holding information while the program is running. The information that is stored in a variable may change,
More informationVisual C# Instructor s Manual Table of Contents
Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms
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 2-1 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 informationLanguage Fundamentals
Language Fundamentals VBA Concepts Sept. 2013 CEE 3804 Faculty Language Fundamentals 1. Statements 2. Data Types 3. Variables and Constants 4. Functions 5. Subroutines Data Types 1. Numeric Integer Long
More informationChapter 2: Introduction to C++
Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 2.1 Parts of a C++
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, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley
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 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 informationC++ Programming: From Problem Analysis to Program Design, Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine
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 informationVB.NET MOCK TEST VB.NET MOCK TEST I
http://www.tutorialspoint.com VB.NET MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to VB.Net. You can download these sample mock tests at your local
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 informationMicrosoft Visual Basic 2015: Reloaded
Microsoft Visual Basic 2015: Reloaded Sixth Edition Chapter Three Memory Locations and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named constants
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 informationCOMP Primitive and Class Types. Yi Hong May 14, 2015
COMP 110-001 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 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 informationFull file at
Java Programming, Fifth Edition 2-1 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 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 informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More information! A program is a set of instructions that the. ! It must be translated. ! Variable: portion of memory that stores a value. char
Week 1 Operators, Data Types & I/O Gaddis: Chapters 1, 2, 3 CS 5301 Fall 2016 Jill Seaman Programming A program is a set of instructions that the computer follows to perform a task It must be translated
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 informationFeatures of C. Portable Procedural / Modular Structured Language Statically typed Middle level language
1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC
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 informationBits, Words, and Integers
Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are
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 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 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 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 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 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 informationDEPARTMENT OF MATHS, MJ COLLEGE
T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,
More informationDeclaration and Memory
Declaration and Memory With the declaration int width; the compiler will set aside a 4-byte (32-bit) block of memory (see right) The compiler has a symbol table, which will have an entry such as Identifier
More informationVB FUNCTIONS AND OPERATORS
VB FUNCTIONS AND OPERATORS In der to compute inputs from users and generate results, we need to use various mathematical operats. In Visual Basic, other than the addition (+) and subtraction (-), the symbols
More informationJava Programming Fundamentals. Visit for more.
Chapter 4: Java Programming Fundamentals Informatics Practices Class XI (CBSE Board) Revised as per CBSE Curriculum 2015 Visit www.ip4you.blogspot.com for more. Authored By:- Rajesh Kumar Mishra, PGT (Comp.Sc.)
More informationEDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION
EDIABAS Electronic Diagnostic Basic System BEST/2 LANGUAGE DESCRIPTION VERSION 6b Copyright BMW AG, created by Softing AG BEST2SPC.DOC CONTENTS CONTENTS...2 1. INTRODUCTION TO BEST/2...5 2. TEXT CONVENTIONS...6
More informationIntroduction to Computer Use II
Winter 2005 (Section M) Topic B: Variables, Data Types and Expressions Wednesday, January 18 2006 COSC 1530, Winter 2006, Overview (1): Before We Begin Some administrative details Some questions to consider
More information2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program
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 informationLESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:
LESSON 1 FUNDAMENTALS OF C The purpose of this lesson is to explain the fundamental elements of the C programming language. C like other languages has all alphabet and rules for putting together words
More informationOn a 64-bit CPU. Size/Range vary by CPU model and Word size.
On a 64-bit CPU. Size/Range vary by CPU model and Word size. unsigned short x; //range 0 to 65553 signed short x; //range ± 32767 short x; //assumed signed There are (usually) no unsigned floats or doubles.
More informationEx: If you use a program to record sales, you will want to remember data:
Data 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:
More informationVARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.
Lesson 2 VARIABLES Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. WHAT ARE VARIABLES? When you input data (i.e. information) into a computer
More informationCS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University
CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Overview of Source Code Components Comments Library declaration Classes Functions Variables Comments Can
More informationObjectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program
Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationMicrosoft Visual Basic 2005: Reloaded
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named
More informationLesson 02 Working with Data Types MIT 31043, Visual Programming By: S. Sabraz Nawaz
Lesson 02 Working with Data Types MIT 31043, Visual Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT Faculty of Management and Commerce South Eastern University of Sri Lanka Variables
More information4. Inputting data or messages to a function is called passing data to the function.
Test Bank for A First Book of ANSI C 4th Edition by Bronson Link full download test bank: http://testbankcollection.com/download/test-bank-for-a-first-book-of-ansi-c-4th-edition -by-bronson/ Link full
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationLanguage Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */
Overview Language Basics This chapter describes the basic elements of Rexx. It discusses the simple components that make up the language. These include script structure, elements of the language, operators,
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
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 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 informationLecture 2 Tao Wang 1
Lecture 2 Tao Wang 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common programming errors
More informationObjectives. In this chapter, you will:
Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about
More informationProgramming and Data Structures
Programming and Data Structures Teacher: Sudeshna Sarkar sudeshna@cse.iitkgp.ernet.in Department of Computer Science and Engineering Indian Institute of Technology Kharagpur #include int main()
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 informationInformation Science 1
Topics covered Information Science 1 Terms and concepts from Week 8 Simple calculations Documenting programs Simple Calcula,ons Expressions Arithmetic operators and arithmetic operator precedence Mixed-type
More informationInformation Science 1
Information Science 1 Simple Calcula,ons Week 09 College of Information Science and Engineering Ritsumeikan University Topics covered l Terms and concepts from Week 8 l Simple calculations Documenting
More informationChapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationWill introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators
Operators Overview Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators Operands and Operators Mathematical or logical relationships
More informationProgramming in C++ 5. Integral data types
Programming in C++ 5. Integral data types! Introduction! Type int! Integer multiplication & division! Increment & decrement operators! Associativity & precedence of operators! Some common operators! Long
More information2. A GUI A. uses buttons, menus, and icons B. should be easy for a user to manipulate C. both (a) and (b) D. stands for Graphic Use Interaction
1. Which language is not a true object-oriented programming language? A. VB 6 B. VB.NET C. JAVA D. C++ 2. A GUI A. uses buttons, menus, and icons B. should be easy for a user to manipulate C. both (a)
More informationFundamentals of Programming
Fundamentals of Programming Lecture 3 - Constants, Variables, Data Types, And Operations Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad Outline C Program Data types Variables
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 informationLECTURE 3 C++ Basics Part 2
LECTURE 3 C++ Basics Part 2 OVERVIEW Operators Type Conversions OPERATORS Operators are special built-in symbols that have functionality, and work on operands. Operators are actually functions that use
More informationChapter 2. Designing a Program. Input, Processing, and Output Fall 2016, CSUS. Chapter 2.1
Chapter 2 Input, Processing, and Output Fall 2016, CSUS Designing a Program Chapter 2.1 1 Algorithms They are the logic on how to do something how to compute the value of Pi how to delete a file how to
More informationOperators. Lecture 3 COP 3014 Spring January 16, 2018
Operators Lecture 3 COP 3014 Spring 2018 January 16, 2018 Operators Special built-in symbols that have functionality, and work on operands operand an input to an operator Arity - how many operands an operator
More informationGetting started with Java
Getting started with Java Magic Lines public class MagicLines { public static void main(string[] args) { } } Comments Comments are lines in your code that get ignored during execution. Good for leaving
More informationCIS 3260 Intro to Programming with C#
Variables, Constants and Calculations McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Define a variable Distinguish between variables, constants, and control objects Differentiate
More informationObject Oriented Programming with Visual Basic.Net
Object Oriented Programming with Visual Basic.Net By: Dr. Hossein Hakimzadeh Computer Science and Informatics IU South Bend (c) Copyright 2007 to 2015 H. Hakimzadeh 1 What do we need to learn in order
More informationFundamental of Programming (C)
Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering
More informationLESSON 5 FUNDAMENTAL DATA TYPES. char short int long unsigned char unsigned short unsigned unsigned long
LESSON 5 ARITHMETIC DATA PROCESSING The arithmetic data types are the fundamental data types of the C language. They are called "arithmetic" because operations such as addition and multiplication can be
More informationLECTURE 02 INTRODUCTION TO C++
PowerPoint Slides adapted from *Starting Out with C++: From Control Structures through Objects, 7/E* by *Tony Gaddis* Copyright 2012 Pearson Education Inc. COMPUTER PROGRAMMING LECTURE 02 INTRODUCTION
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 informationCOMP1730/COMP6730 Programming for Scientists. Data: Values, types and expressions.
COMP1730/COMP6730 Programming for Scientists Data: Values, types and expressions. Lecture outline * Data and data types. * Expressions: computing values. * Variables: remembering values. What is data?
More informationChapter 2 Working with Data Types and Operators
JavaScript, Fourth Edition 2-1 Chapter 2 Working with Data Types and Operators At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics
More informationCHAPTER 3 BASIC INSTRUCTION OF C++
CHAPTER 3 BASIC INSTRUCTION OF C++ MOHD HATTA BIN HJ MOHAMED ALI Computer programming (BFC 20802) Subtopics 2 Parts of a C++ Program Classes and Objects The #include Directive Variables and Literals Identifiers
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 informationThe PCAT Programming Language Reference Manual
The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language
More informationProgramming in C++ 6. Floating point data types
Programming in C++ 6. Floating point data types! Introduction! Type double! Type float! Changing types! Type promotion & conversion! Casts! Initialization! Assignment operators! Summary 1 Introduction
More informationPrimitive Data Types: Intro
Primitive Data Types: Intro Primitive data types represent single values and are built into a language Java primitive numeric data types: 1. Integral types (a) byte (b) int (c) short (d) long 2. Real types
More informationChapter 17. Fundamental Concepts Expressed in JavaScript
Chapter 17 Fundamental Concepts Expressed in JavaScript Learning Objectives Tell the difference between name, value, and variable List three basic data types and the rules for specifying them in a program
More information9/21/17. Outline. Expression Evaluation and Control Flow. Arithmetic Expressions. Operators. Operators. Notation & Placement
Outline Expression Evaluation and Control Flow In Text: Chapter 6 Notation Operator evaluation order Operand evaluation order Overloaded operators Type conversions Short-circuit evaluation of conditions
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 informationBITG 1233: Introduction to C++
BITG 1233: Introduction to C++ 1 Learning Outcomes At the end of this lecture, you should be able to: Identify basic structure of C++ program (pg 3) Describe the concepts of : Character set. (pg 11) Token
More informationCHAPTER 3 Expressions, Functions, Output
CHAPTER 3 Expressions, Functions, Output More Data Types: Integral Number Types short, long, int (all represent integer values with no fractional part). Computer Representation of integer numbers - Number
More informationWork relative to other classes
Work relative to other classes 1 Hours/week on projects 2 C BOOTCAMP DAY 1 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Overview C: A language
More information