Microsoft Visual Basic 2015: Reloaded
|
|
- Alexander Potter
- 6 years ago
- Views:
Transcription
1 Microsoft Visual Basic 2015: Reloaded Sixth Edition Chapter Three Memory Locations and Calculations
2 Objectives After studying this chapter, you should be able to: Declare variables and named constants Assign data to an existing variable Convert data to the appropriate type using the TryParse method, Convert class methods, and a literal type character Write and evaluate arithmetic expressions Understand the scope and lifetime of variables and named constant 2
3 Objectives (cont d.) Understand the purpose of the Option statements Use a TOE chart, pseudocode, and a flowchart to code an application Format an application s numeric output Clear the contents of a control s Text property during run time Send the focus to a control during run time Explain the different types of program errors 3
4 Internal Memory Figure 3-1: Illustration of shoe boxes and memory locations Memory locations can also be reserved (declared) by a programmer for use in a program The data type indicates the type of data for example, numeric or string the memory location will store 4
5 Variables A variable is a computer memory location that a programmer uses to temporarily store data while an application is running Figure 3-2: How to name a variable 5
6 Variables (cont d.) Figure 3-3: Basic data types in Visual Basic 6
7 Variables (cont d.) Integer, Long, or Short data types store integers, which are positive or negative numbers and have no decimal places Decimal, Double, or Single data types store real numbers, which are numbers that contain a decimal place Char data type can store one Unicode character String data type can store from zero to approximately two billion Unicode characters Boolean data type can store Boolean values (True or False) Date data type can store date and time information Object data type can store any type of data 7
8 Variables (cont d.) Declaring a Variable in Code The declaration statement tells the computer to set aside a small section of its internal memory, and it allows the programmer to refer to the section by the variable s name The {Dim Private Static} portion of the syntax indicates that you can select only one of the keywords appearing within the braces Figure 3-4: How to declare a variable 8
9 Assigning Data to an Existing Variable A literal constant An item of data whose value does not change during run time A literal type character Forces a literal constant to assume a data type other than the one its form indicates 9
10 Assigning Data to an Existing Variable 10 Figure 3-5: How to assign a value to an existing variable
11 Assigning Data to an Existing Variable (cont d.) Using the TryParse Method Each data type in Visual Basic is a class Most classes have one or more methods that perform a specific task for the class All of the Visual Basic numeric data types (such as Double, Decimal, or Integer) have a TryParse method The TryParse method s task is to convert a string to a particular numeric data type 11
12 Assigning Data to an Existing Variable (cont d.) 12 Figure 3-6: How to use the basic syntax of the TryParse method
13 Assigning Data to an Existing Variable (cont d.) The dot member access operator in the syntax indicates that the TryParse method is a member of the datatype class The TryParse method parses its string argument to determine whether the string can be converted to a number of the specified data type An empty string, also referred to as a zero-length string, is a set of quotation marks with nothing between them 13
14 Assigning Data to an Existing Variable (cont d.) Figure 3-7: Results of the TryParse method for the Double, Decimal, and Integer data types 14
15 Assigning Data to an Existing Variable (cont d.) Using the Convert Class Methods At times, you may need to convert a number (rather than a string) from one data type to another use one of the methods defined in the Convert class The syntax for includes the dot member access operator which indicates that the method is a member of the Convert class In most cases, the method s value argument is a numeric value that you want converted either to the String data type or to a different numeric data type 15
16 Assigning Data to an Existing Variable (cont d.) 16 Figure 3-8: How to use the Convert class methods
17 Arithmetic Expressions Figure 3-9: Most commonly used arithmetic operators The integer division operator is used to divide two integers and then return the result as an integer The modulus operator (sometimes referred to as the remainder operator) is also used to divide two numbers, but the numbers do not have to be integers After dividing the numbers, the modulus operator returns the remainder of the division 17
18 Arithmetic Expressions (cont d.) Figure 3-10: How to use the integer division and Mod operators 18
19 Arithmetic Expressions (cont d.) Figure 3-11: How to evaluate expressions containing operators with the same precedence 19
20 Arithmetic Expressions (cont d.) Figure 3-12: How to assign the result of an arithmetic expression to a variable (continues) 20
21 Arithmetic Expressions (cont d.) (continued) Figure 3-12: How to assign the result of an arithmetic expression to a variable 21
22 Arithmetic Expressions (cont d.) Arithmetic Assignment Operators Use the arithmetic assignment operators to abbreviate an assignment statement that contains an arithmetic operator variablename = variablename arithmeticoperator value age = age + 1 Use the addition assignment operator (+=) to abbreviate the statement above as follows: age += 1 Both statements tell the computer to add the number 1 to the contents of the age variable and then store the result in the variable 22
23 Arithmetic Expressions (cont d.) 23 Figure 3-13: How to use the arithmetic assignment operators (continues)
24 Arithmetic Expressions (cont d.) Figure 3-13: How to use the arithmetic assignment operators 24
25 Scope and Lifetime A variable s scope indicates where the variable can be used in an application s code A variable s lifetime indicates how long the variable remains in the computer s internal memory Variables can have class scope, procedure scope, or block scope Variables declared in a form s Declarations section have class scope Variables declared in a procedure have procedure scope or block depending on where in the procedure they are declared 25
26 Scope and Lifetime (cont d.) Programmers use comments to document a procedure s purpose and to explain various sections of a procedure s code Figure 3-14: Variables declared in the form s Declarations section and calcbutton_click procedure 26
27 Scope and Lifetime (cont d.) Variables with Procedure Scope Variables declared in a procedure are called procedure-level variables Procedure-level variables: Have procedure scope because they can be used only within the procedure in which it is declared Are typically declared at the beginning of a procedure, and remain in the computer s internal memory only while the procedure is running Are declared using the Dim keyword 27
28 Scope and Lifetime (cont d.) Figure 3-15: Sample run of the Discount Calculator application 28
29 Scope and Lifetime (cont d.) Figure 3-16: Click event procedures using procedure-level variables (continues) 29
30 Scope and Lifetime (cont d.) (continued) 30 Figure 3-16: Click event procedures using procedure-level variables
31 Scope and Lifetime (cont d.) In an application you can use the same name to declare a variable in more than one procedure When this is done, each procedure creates its own variable when the procedure is invoked Each procedure also destroys its own variable when the procedure ends Each variable is located in a different section in the computer s internal memory and each is an independent entity 31
32 Scope and Lifetime (cont d.) Figure 3-17: Illustration of shoe boxes and variables 32
33 Scope and Lifetime (cont d.) Variables with Class Scope A class-level variable has class scope Class-level variables: Are declared in the form s Declarations section, which begins with the Public Class clause and ends with the End Class clause Retain their values and remain in the computer s internal memory until the application ends Are declared using the Private keyword 33
34 Scope and Lifetime (cont d.) Figure 3-18: Sample run of the Total Calories application 34 Figure 3-19: Total Calories application s code using a class-level variable
35 Scope and Lifetime (cont d.) Static Variables Variables are declared using the Dim, Private, or Static keywords A static variable is a procedure-level variable that remains in memory, and also retains its value, even when the procedure in which it is declared ends Like a class-level variable, a static variable is not removed from the computer s internal memory until the application ends Unlike a class-level variable, which can be used by all the procedures in a form, a static variable can be used only by the procedure in which it is declared 35
36 Scope and Lifetime (cont d.) Figure 3-20: Total Calories application s code using a static variable 36
37 Named Constants A named constant is a computer memory location whose contents cannot be changed during run time Declare a named constant using the Const statement Named constants make code more self-documenting and easier to modify because they allow a programmer to use meaningful words in place of values that are less clear 37
38 Scope and Lifetime (cont d.) 38 Figure 3-21: How to declare a named constant
39 Option Statements Option Explicit and Option Infer Every variable should appear in a declaration statement, such as a Dim, Private, or Static statement Option Strict If the value s data type does not match the memory location s data type, implicit type conversion occurs to convert the value to fit the memory location When a value is converted from one data type to another data type that can store either larger numbers or numbers with greater precision, the value is said to be promoted 39
40 Option Statements (cont d.) When a value is converted from one data type to another data type that can store only smaller numbers or numbers with less precision, the value is said to be demoted 40 Figure 3-22: How to use the type conversion rules with Option Strict On
41 Option Statements (cont d.) Figure 3-23: Option statements entered in the General Declarations section 41
42 Completing the Say Cheese! Company s Application 42 Figure 3-24: Interface from Chapter 2
43 Completing the Say Cheese! Company s Application (cont d.) Figure 3-25: TOE chart from Chapter 2 43
44 Completing the Say Cheese! Company s Application (cont d.) Using Pseudocode to Plan a Procedure Pseudocode uses short phrases to describe the steps a procedure must take to accomplish its goal Figure 3-26: Pseudocode for the Say Cheese! company s application 44
45 Completing the Say Cheese! Company s Application (cont d.) Using a Flowchart to Plan a Procedure A flowchart uses standardized symbols to show the steps a procedure must follow to reach its goal Flowcharts contain at least three different symbols: The oval symbol is called the start/stop symbol The rectangles are called process symbols The parallelogram in a flowchart is called the input/output symbol and is used to represent input tasks The lines connecting the symbols in a flowchart are called flowlines 45
46 Completing the Say Cheese! Company s Application (cont d.) Figure 3-27: Flowcharts for the Say Cheese! Company s application 46
47 Coding the calcbutton s Click Event Procedure Figure 3-28: Pseudocode for the calcbutton_click procedure Figure 3-29: Memory locations for the calcbutton_click procedure 47
48 Coding the calcbutton s Click Event Procedure (cont d.) Figure 3-30: Declaration statements entered in the procedure 48 Figure 3-31: TryParse methods entered in the procedure
49 Coding the calcbutton s Click Event Procedure (cont d.) Figure 3-32: Calculation statements entered in the procedure 49 Figure 3-33: Display statements and a sample run
50 Coding the calcbutton s Click Event Procedure (cont d.) Formatting Numeric Output Specifying the number of decimal places and the special characters to display in a number is called formatting The ToString method converts a numeric value to a string Places a copy of the variable s or named constant s contents in a temporary memory location Then converts the copy to a string 50
51 Coding the calcbutton s Click Event Procedure (cont d.) Figure 3-34: How to format a number using the ToString method (continues) 51
52 Coding the calcbutton s Click Event Procedure (cont d.) 52 Figure 3-34: How to format a number using the ToString method
53 Coding the calcbutton s Click Event Procedure (cont d.) Figure 3-35: Modified calcbutton_click procedure 53
54 Coding the clearbutton s Click Event Procedure Figure 3-36: Pseudocode for the clearbutton_click procedure 54
55 Coding the clearbutton s Click Event Procedure (cont d.) Two ways to clear the Text property of a control: Assign an empty (or zero-length) string to the property Assign the value String.Empty to the property Figure 3-37: How to clear the Text property of a control 55
56 Coding the clearbutton s Click Event Procedure (cont d.) The Focus method sends the focus to the nametextbox Figure 3-38: How to send the focus to a control Figure 3-39: clearbutton_click procedure 56
57 Coding the exitbutton_click and printbutton_click Procedures Procedure Figure 3-40: Say Cheese! company s program (continues) 57
58 Coding the exitbutton_click and printbutton_click Procedures Procedure (cont d.) 58 Figure 3-40: Say Cheese! company s program
59 Testing and Debugging the Application Applications must be tested to verify that the code works correctly A logic error can occur for a variety of reasons A run time error causes the application to end abruptly Your sample input data should include both valid and invalid data Valid data is data that the application is expecting the user to enter Invalid data is data that the application is not expecting the user to enter 59
60 Programming Tutorial 1 Figure 3-41: TOE chart for the Basketball Score application Figure 3-50: Sample run of the Basketball Score application 60
61 Programming Tutorial 2 Figure 3-54: MainForm for the Alligator Inc. application 61 Figure 3-58: Sample run of the Alligator Inc. application
62 Programming Example Figure 3-63: Sample run of the VitaDrink Company application 62
63 Summary Each memory location in the computer s internal memory can store only one item at a time Variables and named constants are computer memory locations that the programmer uses to store data while an application is running All variables and named constants have a name, data type, initial value, scope, and lifetime The name assigned to a memory location (variable or named constant) should describe the memory location s contents 63
64 Summary (cont'd.) A variable declared in a procedure has procedure scope, and its declaration statement begins with either the keyword Dim or the keyword Static A variable declared in a form s Declarations section has class scope, and its declaration statement begins with the keyword Private You can use an assignment statement to assign a value to an existing variable during run time A literal constant is an item of data whose value does not change during run time 64
65 Summary (cont'd.) You can use the D literal type character to force a Double literal constant (number) to assume the Decimal data type String literal constants are enclosed in quotation marks ("") You can use the TryParse method to convert a string to a number The Convert class contains methods that convert values to a specified data type 65
66 Summary (cont'd.) When an arithmetic expression contains the name of a memory location the computer uses the value stored inside the memory location to process the expression You can use the arithmetic assignment operators to abbreviate some assignment statements A procedure-level memory location can be used only by the procedure in which it is declared Procedure-level variables declared with the Dim keyword are removed from memory when the procedure ends 66
67 Summary (cont'd.) A class-level memory location can be used by all the procedures in the form, including the procedures associated with the controls contained on the form Programmers use comments to internally document an application s code. Comments begin with an apostrophe (') Use the Const statement to declare a named constant The Option Explicit On statement tells the Code Editor to flag the name of an undeclared variable in the code 67 Microsoft Visual Basic 2015: Reloaded, Sixth Edit
68 Summary (cont'd.) The Option Infer Off statement tells the Code Editor to warn you if a declaration statement does not contain a data type The Option Strict On statement tells the computer not to perform any implicit type conversions that may lead to a loss of data Programmers commonly use either pseudocode (short phrases) or a flowchart (standardized symbols) when planning a procedure s code 68
69 Summary (cont'd.) Use the ToString method to format an application s numeric output so that it displays special characters (such as dollar signs and commas) and a specified number of decimal places While an application is running, you can remove the contents of a text box or label by assigning either the empty string ("") or the String.Empty value to the control s Text property 69
70 Summary (cont'd.) You can use the Focus method to move the focus to a control during run time Test a procedure immediately after coding it so you will know where to look if the program contains an error After coding an application, you should test it using both valid and invalid data values to verify that the code is working correctly Programs can contain syntax errors, logic errors, or run time errors 70
71 Summary (cont'd.) To use the Project Designer window to set Option Explicit, Option Strict, and Option Infer for the current project, right-click My Project in the Solution Explorer window, click Open, click the Compile tab, set the options, and then close the Project Designer window To use the Options dialog box to set Option Explicit, Option Strict, and Option Infer for all of the projects you create, click Tools on the Visual Studio menu bar, click Options, expand the Projects and Solutions node, click VB Defaults, set the options, and then click the OK button 71
SKILL AREA 306: DEVELOP AND IMPLEMENT COMPUTER PROGRAMS
Add your company slogan SKILL AREA 306: DEVELOP AND IMPLEMENT COMPUTER PROGRAMS Computer Programming (YPG) LOGO 306.1 Review Selected Programming Environment 306.1.1 Explain the concept of reserve words,
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 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 informationIntroduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4.
Introduction to Visual Basic and Visual C++ Arithmetic Expression Lesson 4 Calculation I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Arithmetic Expression Using Arithmetic Expression Calculations
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 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 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 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 informationIT 374 C# and Applications/ IT695 C# Data Structures
IT 374 C# and Applications/ IT695 C# Data Structures Module 2.1: Introduction to C# App Programming Xianrong (Shawn) Zheng Spring 2017 1 Outline Introduction Creating a Simple App String Interpolation
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 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 informationMicrosoft Visual Basic 2015: Reloaded
Microsoft Visual Basic 2015: Reloaded Sixth Edition Chapter Five More on the Selection Structure Objectives After studying this chapter, you should be able to: Determine whether a solution requires a nested
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 informationDATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Database Program: Microsoft Access Series DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) AGENDA 3. Executing VBA
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 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 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 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 informationChapter Nine Arrays. Sixth Edition
Microsoft Visual Basic 2015: Reloaded Sixth Edition Chapter Nine Arrays Objectives After studying this chapter, you should be able to: Declare and initialize one-dimensional and twodimensional arrays Store
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 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 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 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 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 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 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 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-8 DATA TYPES. Introduction. Variable:
Chapter-8 DATA TYPES Introduction To understand any programming languages we need to first understand the elementary concepts which form the building block of that program. The basic building blocks include
More informationSkill Area 306: Develop and Implement Computer Program
Add your company slogan Skill Area 306: Develop and Implement Computer Program Computer Programming (YPG) LOGO Skill Area 306.2: Produce Structured Program 306.2.1 Write Algorithm 306.2.2 Apply appropriate
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 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 informationMicrosoft Visual Basic 2015: Reloaded
Microsoft Visual Basic 2015: Reloaded Sixth Edition Chapter Seven More on the Repetition Structure Objectives After studying this chapter, you should be able to: Code a counter-controlled loop Nest repetition
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 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 informationProgramming Logic and Design Seventh Edition Chapter 2 Elements of High-Quality Programs
Programming Logic and Design Chapter 2 Elements of High-Quality Programs Objectives In this chapter, you will learn about: Declaring and using variables and constants Assigning values to variables [assignment
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 informationVisual BASIC Creating an Application. Choose File New Project from the menu
Creating an Application Choose File New Project from the menu Choose Windows Application Name the project Copyright Project Place a check in the Create directory for solution box Click Browse Choose and/or
More informationAn Introduction to Programming with C++ Sixth Edition. Chapter 7 The Repetition Structure
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure Objectives Differentiate between a pretest loop and a posttest loop Include a pretest loop in pseudocode Include
More informationModel Viva Questions for Programming in C lab
Model Viva Questions for Programming in C lab Title of the Practical: Assignment to prepare general algorithms and flow chart. Q1: What is a flowchart? A1: A flowchart is a diagram that shows a continuous
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 informationPseudocode is an abbreviated version of the actual statement t t (or code ) in the program.
Pseudocode Pseudocode is an abbreviated version of the actual statement t t (or code ) in the program. It is a type of algorithm in that all steps needed to solve the problem must be listed. 1 While algorithms
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 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 31-1. These are the highest and lowest values that
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 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 informationegrapher Language Reference Manual
egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction
More informationJAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 2 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) AGENDA
More informationVba Variables Constant and Data types in Excel
Vba Variables Constant and Data types in Excel VARIABLES In Excel VBA, variables are areas allocated by the computer memory to hold data. Data stored inside the computer memory has 4 properties: names,
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 informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Education, Inc. All Rights Reserved. Each class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed;
More informationAn Introduction to Programming with C++ Sixth Edition. Chapter 2 Beginning the Problem-Solving Process
An Introduction to Programming with C++ Sixth Edition Chapter 2 Beginning the Problem-Solving Process Objectives Explain the problem-solving process used to create a computer program Analyze a problem
More information4. The is a diagram that graphically depicts the steps that take place in a program. a. Program b. Flowchart c. Algorithm d. Code e.
Gaddis: Starting Out with Programming Logic & Design Test Bank Chapter Two MULTIPLE CHOICE 1. Which error produces incorrect results but does not prevent the program from running? a. syntax b. logic c.
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 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 informationIntro to Computer Programming (ICP) Rab Nawaz Jadoon
Intro to Computer Programming (ICP) Rab Nawaz Jadoon DCS COMSATS Institute of Information Technology Assistant Professor COMSATS IIT, Abbottabad Pakistan Introduction to Computer Programming (ICP) What
More informationC++ Basic Elements of COMPUTER PROGRAMMING. Special symbols include: Word symbols. Objectives. Programming. Symbols. Symbols.
EEE-117 COMPUTER PROGRAMMING Basic Elements of C++ Objectives General Questions Become familiar with the basic components of a C++ program functions, special symbols, and identifiers Data types Arithmetic
More informationJava+- Language Reference Manual
Fall 2016 COMS4115 Programming Languages & Translators Java+- Language Reference Manual Authors Ashley Daguanno (ad3079) - Manager Anna Wen (aw2802) - Tester Tin Nilar Hlaing (th2520) - Systems Architect
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 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 informationIndex. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309
A Arithmetic operation floating-point arithmetic, 11 12 integer numbers, 9 11 Arrays, 97 copying, 59 60 creation, 48 elements, 48 empty arrays and vectors, 57 58 executable program, 49 expressions, 48
More informationChapter Ten String Manipulation and Menus
Microsoft Visual Basic 2015: Reloaded Sixth Edition Chapter Ten String Manipulation and Menus Objectives After studying this chapter, you should be able to: Determine the number of characters in a string
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 informationCSE 123 Introduction to Computing
CSE 123 Introduction to Computing Lecture 6 Programming with VBA (Projects, forms, modules, variables, flowcharts) SPRING 2012 Assist. Prof. A. Evren Tugtas Starting with the VBA Editor Developer/Code/Visual
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 31-1. These are the highest and lowest values that
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 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 informationEnableBasic. The Enable Basic language. Modified by Admin on Sep 13, Parent page: Scripting Languages
EnableBasic Old Content - visit altium.com/documentation Modified by Admin on Sep 13, 2017 Parent page: Scripting Languages This Enable Basic Reference provides an overview of the structure of scripts
More informationChapter 02: Using Data
True / False 1. A variable can hold more than one value at a time. ANSWER: False REFERENCES: 54 2. The int data type is the most commonly used integer type. ANSWER: True REFERENCES: 64 3. Multiplication,
More informationExpressions. Arithmetic expressions. Logical expressions. Assignment expression. n Variables and constants linked with operators
Expressions 1 Expressions n Variables and constants linked with operators Arithmetic expressions n Uses arithmetic operators n Can evaluate to any value Logical expressions n Uses relational and logical
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 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 informationA First Program - Greeting.cpp
C++ Basics A First Program - Greeting.cpp Preprocessor directives Function named main() indicates start of program // Program: Display greetings #include using namespace std; int main() { cout
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 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 informationCSc Introduction to Computing
CSc 10200 Introduction to Computing Lecture 2 Edgardo Molina Fall 2011 - City College of New York Thursday, September 1, 2011 Introduction to C++ Modular program: A program consisting of interrelated segments
More informationIntroduction to C++ Introduction. Structure of a C++ Program. Structure of a C++ Program. C++ widely-used general-purpose programming language
Introduction C++ widely-used general-purpose programming language procedural and object-oriented support strong support created by Bjarne Stroustrup starting in 1979 based on C Introduction to C++ also
More informationComputers Programming Course 6. Iulian Năstac
Computers Programming Course 6 Iulian Năstac Recap from previous course Data types four basic arithmetic type specifiers: char int float double void optional specifiers: signed, unsigned short long 2 Recap
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. 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 informationGraphQuil Language Reference Manual COMS W4115
GraphQuil Language Reference Manual COMS W4115 Steven Weiner (Systems Architect), Jon Paul (Manager), John Heizelman (Language Guru), Gemma Ragozzine (Tester) Chapter 1 - Introduction Chapter 2 - Types
More informationIntroduction to C++ with content from
Introduction to C++ with content from www.cplusplus.com 2 Introduction C++ widely-used general-purpose programming language procedural and object-oriented support strong support created by Bjarne Stroustrup
More informationArithmetic Operations
232 Chapter 4 Variables and Arithmetic Operations Arithmetic Operations The ability to perform arithmetic operations on numeric data is fundamental to computer programs. Many programs require arithmetic
More informationPetros: A Multi-purpose Text File Manipulation Language
Petros: A Multi-purpose Text File Manipulation Language Language Reference Manual Joseph Sherrick js2778@columbia.edu June 20, 2008 Table of Contents 1 Introduction...................................................
More informationNOTES: Variables & Constants (module 10)
Computer Science 110 NAME: NOTES: Variables & Constants (module 10) Introduction to Variables A variable is like a container. Like any other container, its purpose is to temporarily hold or store something.
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 2. Building Multitier Programs with Classes The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill
Chapter 2 Building Multitier Programs with Classes McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Objectives Discuss object-oriented terminology Create your own class and instantiate
More informationPseudo Code and Flow Charts. Chapter 1 Lesson 2
Pseudo Code and Flow Charts Chapter 1 Lesson 2 Pseudocode Using Pseudocode Statements and Flowchart Symbols English-like representation of the logical steps it takes to solve a problem Flowchart Pictorial
More informationData and Operations. Outline
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
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 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 informationTypes and Expressions. Chapter 3
Types and Expressions Chapter 3 Chapter Contents 3.1 Introductory Example: Einstein's Equation 3.2 Primitive Types and Reference Types 3.3 Numeric Types and Expressions 3.4 Assignment Expressions 3.5 Java's
More informationIntroduction to Programming
Introduction to Programming session 6 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Spring 2011 These slides are created using Deitel s slides Sharif University of Technology Outlines
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 informationData Types, Variables and Arrays. OOC 4 th Sem, B Div Prof. Mouna M. Naravani
Data Types, Variables and Arrays OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani Identifiers in Java Identifiers are the names of variables, methods, classes, packages and interfaces. Identifiers must
More informationProgramming for Engineers Introduction to C
Programming for Engineers Introduction to C ICEN 200 Spring 2018 Prof. Dola Saha 1 Simple Program 2 Comments // Fig. 2.1: fig02_01.c // A first program in C begin with //, indicating that these two lines
More informationLe L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators
Course Name: Advanced Java Lecture 2 Topics to be covered Variables Operators Variables -Introduction A variables can be considered as a name given to the location in memory where values are stored. One
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 informationGENERAL INFORMATICS Chapter 3. The Representation of Processing Algorithms Algorithm definition Steps in computer problem solving process
GENERAL INFORMATICS Chapter 3. The Representation of Processing Algorithms 3.1. Algorithm definition 3.2. Steps in computer problem solving process 3.3. Steps for preparing a program for execution 3.4.
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationJava Primer 1: Types, Classes and Operators
Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,
More information