Introducing Visual Basic

Size: px
Start display at page:

Download "Introducing Visual Basic"

Transcription

1 Introducing Visual Basic September 11, 2006 Chapter 3 - VB 2005 by Schneider 1

2 Today Continuing our intro to VB First some housework Chapter 3 - VB 2005 by Schneider 2

3 Classroom Contract Chapter 3 - VB 2005 by Schneider 3

4 Midterm Two choices: October 16th (week 7) October 23rd (week 8) Chapter 3 - VB 2005 by Schneider 4

5 Assignments First assignment will be this week General plan is to assign on Wednesday and have due the following Monday This will be adjusted to reflect how much work is required for the assignment No late assignments Collaboration? Cheating? Chapter 3 - VB 2005 by Schneider 5

6 CS Submission Server All assignments will be turned in via the submission server submit.cs.sfu.ca Currently down while prepping for semester Chapter 3 - VB 2005 by Schneider 6

7 GradeBook gradebook.cs.sfu.ca Check grades Individual assignments Comparative assignments Not set in stone! More info: Chapter 3 - VB 2005 by Schneider 7

8 Textbook Sold out presently Should be in by Friday at latest Chapter 3 - VB 2005 by Schneider 8

9 Now where were we? Back to chapter 3 So far you ve seen 3.1 Visual Basic Controls 3.2 Visual Basic Events Continuing today 3.2 Continuing with Events 3.3 Numbers 3.4 Strings 3.5 Input and Output Chapter 3 - VB 2005 by Schneider 9

10 Recall Control Boxes and buttons E.g. Text Box Control Button Control Label Control List Box Control Event An action (e.g. user click) Chapter 3 - VB 2005 by Schneider 10

11 3.2 Visual Basic Events An Event Procedure Walkthrough Properties and Event Procedures of the Form The Header of an Event Procedure Chapter 3 - VB 2005 by Schneider 39

12 Examples of Events btnshow.click txtbox.textchanged txtbox.leave General Form: controlname.event Chapter 3 - VB 2005 by Schneider 43

13 The three steps in creating a Visual Basic program: 1. Create the interface; that is, generate, position, and size the objects. 2. Set properties; that is, configure the appearance of the objects. 3. Write the code that executes when events occur. Chapter 3 - VB 2005 by Schneider 44

14 The three steps in creating a Visual Basic program: 1. Create the interface; that is, generate, position, and size the objects. 2. Set properties; that is, configure the appearance of the objects. 3. Write the code that executes when events occur. Chapter 3 - VB 2005 by Schneider 45

15 Code Consists of statements that carry out tasks E.g. change properties of a control or form Chapter 3 - VB 2005 by Schneider 46

16 Code Window Page tab Class Name box Method Name box Chapter 3 - VB 2005 by Schneider 48

17 Structure of an Event Procedure Header Private Sub objectname_event(...) Handles objectname.event statements End Sub (...) is filled automatically with (ByVal sender As System.Object, ByVal e As System.EventArgs) Chapter 3 - VB 2005 by Schneider 49

18 Create an Outline for an Event Procedure; i.e. header and End Sub 1. Double-click on a control or 2. Use the Class Name and Method Name boxes. (We primarily use the first method.) Chapter 3 - VB 2005 by Schneider 50

19 Sample Form txtfirst txtsecond btnred Double Click on txtfirst Chapter 3 - VB 2005 by Schneider 51

20 Code for Walkthrough Public Class frmdemo Private Sub txtfirst_textchanged(...) Handles txtfirst.textchanged End Sub End Class Chapter 3 - VB 2005 by Schneider 52

21 Code for Walkthrough Public Class frmdemo Private Sub txtfirst_textchanged(...) Handles txtfirst.textchanged txtfirst.forecolor = Color.Blue End Sub End Class Chapter 3 - VB 2005 by Schneider 53

22 IntelliSense Automatically pops up to give the programmer help. Chapter 3 - VB 2005 by Schneider 54

23 Code Window Click tab to return to Form Designer Chapter 3 - VB 2005 by Schneider 55

24 Sample Form txtfirst txtsecond btnred Double-click on btnred Chapter 3 - VB 2005 by Schneider 56

25 Code for Walkthrough Public Class frmdemo Private Sub txtfirst_textchanged(...) Handles txtfirst.textchanged txtfirst.forecolor = Color.Blue End Sub Private Sub btnred_click(...) Handles btnred.click End Sub End Class Chapter 3 - VB 2005 by Schneider 57

26 Code for Walkthrough Public Class frmdemo Private Sub txtfirst_textchanged(...) Handles txtfirst.textchanged txtfirst.forecolor = Color.Blue End Sub Private Sub btnred_click(...) Handles btnred.click txtfirst.forecolor = Color.Red End Sub End Class Chapter 3 - VB 2005 by Schneider 58

27 Event Procedure txtfirst.leave Select txtfirst from Class Name box drop-down list. Select Leave from Method Name box drop-down list. Chapter 3 - VB 2005 by Schneider 59

28 Code for Walkthrough Private Sub txtfirst_leave(...) Handles txtfirst.leave End Sub Private Sub txtfirst_textchanged(...) Handles txtfirst.textchanged txtfirst.forecolor = Color.Blue End Sub Private Sub btnred_click(...) Handles btnred.click txtfirst.forecolor = Color.Red End Sub Chapter 3 - VB 2005 by Schneider 60

29 Code for Walkthrough Private Sub txtfirst_leave(...) Handles txtfirst.leave txtfirst.forecolor = Color.Black End Sub Private Sub txtfirst_textchanged(...) Handles txtfirst.textchanged txtfirst.forecolor = Color.Blue End Sub Private Sub btnred_click(...) Handles btnred.click txtfirst.forecolor = Color.Red End Sub Chapter 3 - VB 2005 by Schneider 61

30 Header of Event Procedure Private Sub btnred_click( ) Handles btnred.click Name, can be changed. Identifies event Private Sub Button_Press( ) Handles btnred.click Chapter 3 - VB 2005 by Schneider 62

31 Handling Multiple Events Event procedure can be invoked by two events. Private Sub Button_Click(...) Handles btnred.click, txtsecond.leave txtfirst.forecolor = Color.Red End Sub Chapter 3 - VB 2005 by Schneider 63

32 Altering Properties of the Form The following won't work: frmdemo.text = "Demonstration" The form is referred to by the keyword Me. Me.Text = "Demonstration" Chapter 3 - VB 2005 by Schneider 64

33 3.3 Numbers Arithmetic Operations Variables Incrementing the Value of a Variable Built-In Functions: Math.Sqrt Int Math.Round Chapter 3 - VB 2005 by Schneider 65

34 Numbers continued The Integer Data Type Multiple Declarations Parentheses Three Types of Errors Chapter 3 - VB 2005 by Schneider 66

35 Arithmetic Operations Numbers are called numeric literals Five arithmetic operations in Visual Basic + addition - subtraction * multiplication / division ^ exponentiation Chapter 3 - VB 2005 by Schneider 67

36 Numeric Expressions * (4 + 5) 2 ^ 3 Chapter 3 - VB 2005 by Schneider 68

37 Displaying Numbers Let n be a number or a numeric expression. The statement lstbox.items.add(n) displays the value of n in the list box. Chapter 3 - VB 2005 by Schneider 69

38 Example 1: Form Chapter 3 - VB 2005 by Schneider 70

39 Example 1: Code and Output Private Sub btncompute_click (...) Handles btncompute.click lstresults.items.add(5) lstresults.items.add(2 * 3) lstresults.items.add((2 ^ 3) 1) End Sub Output 5 in list 6 box 7 Chapter 3 - VB 2005 by Schneider 71

40 Example 1: Code using With Private Sub btncompute_click (...) Handles btncompute.click With lstresults.items.add(5).add(2 * 3).Add((2 ^ 3) 1) End With End Sub Chapter 3 - VB 2005 by Schneider 72

41 Numeric Variable A numeric variable is a name to which a number can be assigned. Examples: speed distance interestrate balance Chapter 3 - VB 2005 by Schneider 73

42 Variables Declaration: Dim speed As Double Variable name Data type Assignment: speed = 50 Chapter 3 - VB 2005 by Schneider 74

43 Initialization Numeric variables are automatically initialized to 0: Dim varname As Double To specify a nonzero initial value Dim varname As Double = 50 Chapter 3 - VB 2005 by Schneider 75

44 Numeric Expressions Numeric variables can be used in numeric expressions. Dim balance As Double = 1000 lstbox.items.add(1.05 * balance) Output: 1050 Chapter 3 - VB 2005 by Schneider 76

45 Assignment Statement Dim numvar1 As Double = 5 Dim numvar2 As Double = 4 numvar1 = 3 * numvar2 lstbox.items.add(numvar1) Output: 12 Chapter 3 - VB 2005 by Schneider 77

46 Incrementing To add 1 to the numeric variable var var = var + 1 Or as a shortcut var += 1 Or as a generalization var += numeric expression Chapter 3 - VB 2005 by Schneider 78

47 Built-in Functions Functions return a value Math.Sqrt(9) returns 3 Int(9.7) returns 9 Math.Round(2.7) is 3 Chapter 3 - VB 2005 by Schneider 79

48 Integer Data Type Variables of type Double can be assigned both whole numbers and numbers with decimals. The statement Dim varname As Integer declares a numeric variable that can only be assigned whole number values between about -2 billion and 2 billion. Chapter 3 - VB 2005 by Schneider 80

49 Multiple Declarations Dim a, b As Double Two other types of multiple-declaration statements are Dim a As Double, b As Integer Dim c As Double = 2, b As Integer = 5 Chapter 3 - VB 2005 by Schneider 81

50 Parentheses Parentheses should be used liberally in numeric expressions. In the absence of parentheses, the operations are carried out in the following order: ^, * and /, + and -. Chapter 3 - VB 2005 by Schneider 82

51 Three Types of Errors Syntax error Run-time error Logic error Chapter 3 - VB 2005 by Schneider 83

52 Some Types of Syntax Errors Misspellings lstbox.itms.add(3) Omissions lstbox.items.add(2 + ) Incorrect punctuation Dim m; n As Integer Chapter 3 - VB 2005 by Schneider 84

53 A Type of Run-time Error Overflow error Dim numvar As Integer = numvar = numvar * numvar Chapter 3 - VB 2005 by Schneider 85

54 A Logical Error Dim average As Double Dim m As Double = 5 Dim n As Double = 10 average = m + n / 2 Value of average will be 10. Should be 7.5. Chapter 3 - VB 2005 by Schneider 86

55 3.4 Strings Variables and Strings Using Text Boxes for Input and Output Concatenation String Properties and Methods: Length Trim IndexOf ToUpper ToLower Substring Chapter 3 - VB 2005 by Schneider 87

56 Strings continued The Empty String Initial Value of a String Option Strict Internal Documentation Line-Continuation Character Chapter 3 - VB 2005 by Schneider 88

57 String Literal A string literal is a sequence of characters surrounded by quotation marks. Examples: "hello" " " "#ab cde?" Chapter 3 - VB 2005 by Schneider 89

58 String Variable A string variable is a name to which a string value can be assigned. Examples: country ssn word firstname Chapter 3 - VB 2005 by Schneider 90

59 String Variable Declaration: Dim firstname As String Variable name Data type Assignment: firstname = "Fred" Chapter 3 - VB 2005 by Schneider 91

60 String Variable You can declare a string variable and assign it a value at the same time. Dim firstname As String = "Fred" Chapter 3 - VB 2005 by Schneider 92

61 Add Method Let str be a string literal or variable. Then, lstbox.items.add(str) displays the value of str in the list box. Chapter 3 - VB 2005 by Schneider 93

62 String Variable You can assign the value of one string variable to another. Dim strvar1 As String = "Hello" Dim strvar2 As String = "Goodbye" strvar2 = strvar1 lstoutput.items.add(strvar2) Output: Hello Chapter 3 - VB 2005 by Schneider 94

63 Variables and Strings Private Sub btndisplay_click(...) Handles btndisplay.click Dim today As String today = "Monday" lstoutput.items.add("hello") lstoutput.items.add(today) End Sub Output: hello Monday Chapter 3 - VB 2005 by Schneider 95

64 Using Text Boxes for Input and Output The contents of a text box is always a string Input example strvar = txtbox.text Output example txtbox.text = strvar Chapter 3 - VB 2005 by Schneider 96

65 Data Conversion Because the contents of a text box is always a string, sometimes you must convert the input or output. dblvar = CDbl(txtBox.Text) Converts a String to a Double txtbox.text = CStr(numVar) Converts a number to a string Chapter 3 - VB 2005 by Schneider 97

66 Concatenation Combining two strings to make a new string quote1 = "We'll always " quote2 = "have Paris." quote = quote1 & quote2 txtoutput.text = quote & " - Humphrey Bogart" Displays We'll always have Paris. - Humphrey Bogart Chapter 3 - VB 2005 by Schneider 98

67 Appending To append str to the string variable var var = var & str Or as a shortcut var &= str Chapter 3 - VB 2005 by Schneider 99

68 Appending Example Dim var As String = "Good" var &= "bye" txtbox.text = var OUTPUT: Goodbye Chapter 3 - VB 2005 by Schneider 100

69 String Properties and Methods "Visual".Length is 6. "Visual".ToUpper is VISUAL. "123 Hike".Length is 8. "123 Hike".ToLower is 123 hike. "a" & " bcd ".Trim & "efg" is abcdefg. Chapter 3 - VB 2005 by Schneider 101

70 Positions in a String Positions of characters in a string are numbered 0, 1, 2,. Consider the string Visual Basic. Position 0: V Position 1: i Position 7: B Substring al begins at position 4 Chapter 3 - VB 2005 by Schneider 102

71 Substring Method Let str be a string. str.substring(m, n) is the substring of length n, beginning at position m in str. Visual Basic.Substring(2, 3) is sua Visual Basic.Substring(0, 1) is V Chapter 3 - VB 2005 by Schneider 103

72 IndexOf Method Let str1 and str2 be strings. str1.indexof(str2) is the position of the first occurrence of str2 in str1. (Note: Has value -1 if str2 is not a substring of str1.) "Visual Basic".IndexOf("is") is 1. "Visual Basic".IndexOf("si") is 9. "Visual Basic".IndexOf("ab") is -1. Chapter 3 - VB 2005 by Schneider 104

73 The Empty String The string "", which contains no characters, is called the empty string or the zero-length string. The statement lstbox.items.add("") skips a line in the list box. The contents of a text box can be cleared with either the statement txtbox.clear() or the statement txtbox.text = "" Chapter 3 - VB 2005 by Schneider 105

74 Initial Value of a String By default the initial value is Nothing Strings can be given a different initial value as follows: Dim today As String = "Monday" Chapter 3 - VB 2005 by Schneider 106

75 Option Strict Visual Basic allows numeric variables to be assigned strings and vice versa, a poor programming practice. To turn this feature off, put the following statement at the very top of the code window Option Strict On Chapter 3 - VB 2005 by Schneider 107

76 Option Strict On for All Programs Select Options from the Tools menu In left pane, expand Projects and Solution Select VB Defaults Set Option Strict to On Chapter 3 - VB 2005 by Schneider 108

77 With Option Strict On Dim dblvar As Double, intvar As Integer Dim strvar As String Not Valid: Replace with: intvar = dblvar intvar = CInt(dblVar) dblvar = strvar dblvar = CDbl(strVar) strvar = intvar strvar = CStr(intVar) Chapter 3 - VB 2005 by Schneider 109

78 Comments Private Sub btncompute_click (...) Handles btncompute.click 'Calculate the balance in an account Dim rate As Double 'Annual rate of interest Dim curbalance As Double 'Current balance Chapter 3 - VB 2005 by Schneider 110

79 Internal Documentation 1. Other people can easily understand the program. 2. You can understand the program when you read it later. 3. Long programs are easier to read because the purposes of individual pieces can be determined at a glance. Chapter 3 - VB 2005 by Schneider 111

80 Automatic Colorization Comments green String literals maroon Keywords blue Note: Keywords are words such as Sub, Handles, Private, With, and End that have special meaning in Visual Basic. They cannot be used as variable names. Chapter 3 - VB 2005 by Schneider 112

81 Line-Continuation Character A long line of code can be continued on another line by using an underscore (_) preceded by a space msg = "I'm going to make " & _ "him an offer he can't refuse." Chapter 3 - VB 2005 by Schneider 113

82 3.5 Input and Output Formatting Output with Format Functions Formatting Output with Zones Reading Data from Files Getting Input from an Input Dialog Box Using a Message Dialog Box for Output Using a Masked Text Box for Input Chapter 3 - VB 2005 by Schneider 114

83 Formatting Output with Format Functions Function FormatNumber( , 1) FormatCurrency( , 2) FormatPercent(0.183, 0) String Value 12,345.6 $12, % Chapter 3 - VB 2005 by Schneider 115

84 Formatting Output with Zones Use a fixed-width font such as Courier New Divide the characters into zones with a format string. Dim fmtstr As String = "{0, 15}{1, 10}{2, 8}" lstoutput.items.add(string.format(fmtstr, _ data0, data1, data2)) Chapter 3 - VB 2005 by Schneider 116

85 Formatting Output with Zones Dim fmtstr As String = "{0, -15}{1, 10}{2, 8}" lstoutput.items.add(string.format(fmtstr, _ data0, data1, data2)) Here, 15 was preceded by a minus sign. This produces left justification in 0 th zone. There will be right justification in the other two zones. Chapter 3 - VB 2005 by Schneider 117

86 Zone Formatting Symbols Symbols: N, C, and P :Nr :Cr :Pr Effect on zone FormatNumber(data, r) FormatCurrency(data, r) FormatPercent(data, r) Dim fmtstr As String = "{0,15:N1}{1,10:C2}{2,8:P0}" Chapter 3 - VB 2005 by Schneider 118

87 Reading Data from Files Data can be stored in files and accessed with a StreamReader object. We assume that the files are text files (that is, have extension.txt) and have one piece of data per line. Chapter 3 - VB 2005 by Schneider 119

88 Sample File: PAYROLL.TXT Mike Jones John Smith Name Hourly wage Number of hours worked Chapter 3 - VB 2005 by Schneider 120

89 Steps to Use StreamReader Execute a statement of the form Dim readervar As IO.StreamReader = _ IO.File.OpenText(filespec) or the pair of statements Dim readervar As IO.StreamReader readervar = IO.File.OpenText(filespec) Chapter 3 - VB 2005 by Schneider 121

90 Steps to Use StreamReader Read items of data in order, one at a time, from the file with the ReadLine method. strvar = readervar.readline After the desired items have been read from the file, terminate the communications link readervar.close() Chapter 3 - VB 2005 by Schneider 122

91 Example using StreamReader Dim name As String Dim wage, hours As Double Dim sr As IO.StreamReader = _ IO.File.OpenText("PAYROLL.TXT") name = sr.readline wage = CDbl(sr.ReadLine) hours = CDbl(sr.ReadLine) lstbox.items.add(name & ": " & wage * hours) OUTPUT: Mike Jones: Chapter 3 - VB 2005 by Schneider 123

92 Comment on Example Consider lstbox.items.add(name & ": " & wage * hours) The ampersand automatically converted wage * hours into a string before concatenating. We didn t have to convert wage * hours with CStr. Chapter 3 - VB 2005 by Schneider 124

93 Getting Input from an Input Dialog Box stringvar = InputBox(prompt, title) filename = InputBox("Enter the name " _ & "of the file containing the " & _ "information.", "Name of File") Title Prompt Chapter 3 - VB 2005 by Schneider 125

94 Using a Message Dialog Box for Output MsgBox(prompt, 0, title) MsgBox("Nice try, but no cigar.", 0, _ "Consolation") Title Prompt Chapter 3 - VB 2005 by Schneider 126

95 Masked Text Box Similar to an ordinary text box, but has a Mask property that restricts what can be typed into the masked text box. Chapter 3 - VB 2005 by Schneider 127

96 Input Mask Dialog Box Chapter 3 - VB 2005 by Schneider 128

97 Mask A Mask setting is a sequence of characters, with 0, L, and & having special meanings. 0 Placeholder for a digit. L Placeholder for a letter. & Placeholder for a character or space. Chapter 3 - VB 2005 by Schneider 129

98 Sample Masks State abbreviation: LL Phone number: Social Security Number: License plate: &&&&&& Chapter 3 - VB 2005 by Schneider 130

Introducing Visual Basic

Introducing Visual Basic Introducing Visual Basic September 13, 2006 Chapter 3 - VB 2005 by Schneider 1 Today Continuing our intro to VB First some housework Chapter 3 - VB 2005 by Schneider 2 Friday Assignment 1 Vote on midterm

More information

Introducing Visual Basic

Introducing Visual Basic Introducing Visual Basic September 8, 2006 Chapter 3 - VB 2005 by Schneider 1 Today Chapter 3 provides a great walkthrough intro to VB We re going to take a detailed look at this today (and pick it up

More information

HOW TO DEVELOP A VB APPLICATION

HOW TO DEVELOP A VB APPLICATION REVIEW OF CHAPTER 2 HOW TO DEVELOP A VB APPLICATION Design the Interface for the user Literally draw the GUI Drag buttons/text boxes/etc onto form Determine which events the controls on the window should

More information

Review. October 20, 2006

Review. October 20, 2006 Review October 20, 2006 1 A Gentle Introduction to Programming A Program (aka project, application, solution) At a very general level there are 3 steps to program development Determine output Determine

More information

REVIEW OF CHAPTER 1 1

REVIEW OF CHAPTER 1 1 1 REVIEW OF CHAPTER 1 Trouble installing/accessing Visual Studio? 2 Computer a device that can perform calculations and make logical decisions much faster than humans can Computer programs a sequence of

More information

Chapter 2 Visual Basic, Controls, and Events. 2.1 An Introduction to Visual Basic 2.2 Visual Basic Controls 2.3 Visual Basic Events

Chapter 2 Visual Basic, Controls, and Events. 2.1 An Introduction to Visual Basic 2.2 Visual Basic Controls 2.3 Visual Basic Events Chapter 2 Visual Basic, Controls, and Events 2.1 An Introduction to Visual Basic 2.2 Visual Basic Controls 2.3 Visual Basic Events 1 2.1 An Introduction to Visual Basic 2010 Why Windows and Why Visual

More information

Chapter 3. Fundamentals of Programming in Visual Basic

Chapter 3. Fundamentals of Programming in Visual Basic Page 1 of 114 [Page 41] Chapter 3. Fundamentals of Programming in Visual Basic (This item omitted from WebBook edition) 3.1 Visual Basic Controls 42 Starting a New Visual Basic Program A Text Box Walkthrough

More information

Visual Basic distinguishes between a number of fundamental data types. Of these, the ones we will use most commonly are:

Visual Basic distinguishes between a number of fundamental data types. Of these, the ones we will use most commonly are: Chapter 3 4.2, Data Types, Arithmetic, Strings, Input Data Types Visual Basic distinguishes between a number of fundamental data types. Of these, the ones we will use most commonly are: Integer Long Double

More information

Input/Output. Introduc3on

Input/Output. Introduc3on Input/Output CE 311 K - Introduc0on to Computer Methods Daene C. McKinney Forma9ng Numbers Input From Files Output To Files Input Boxes Introduc3on 1 Forma6ng Numbers Display numbers in familiar formats

More information

Outline. Data and Operations. Data Types. Integral Types

Outline. 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 information

ADMIN STUFF. Assignment #1 due. Assignment #2. Midterm. Posted to website Due Oct 11. Review session Oct 16 Midterm in class Oct 18 [2 hours long]

ADMIN STUFF. Assignment #1 due. Assignment #2. Midterm. Posted to website Due Oct 11. Review session Oct 16 Midterm in class Oct 18 [2 hours long] TODAY S QUOTE Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are by definition not smart enough to debug it. (Brian Kernighan)

More information

IT 374 C# and Applications/ IT695 C# Data Structures

IT 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 information

Fundamentals of Programming Session 4

Fundamentals of Programming Session 4 Fundamentals of Programming Session 4 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2011 These slides are created using Deitel s slides, ( 1992-2010 by Pearson Education, Inc).

More information

CSc 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 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 information

Chapter 2.4: Common facilities of procedural languages

Chapter 2.4: Common facilities of procedural languages Chapter 2.4: Common facilities of procedural languages 2.4 (a) Understand and use assignment statements. Assignment An assignment is an instruction in a program that places a value into a specified variable.

More information

Repetition. October 4, Chapter 6 - VB 2005 by Schneider 1

Repetition. October 4, Chapter 6 - VB 2005 by Schneider 1 Repetition October 4, 2006 Chapter 6 - VB 2005 by Schneider 1 Chapter 6 Repetition 6.1 Do Loops 6.2 Processing Lists of Data with Do Loops 6.3 For...Next Loops 6.4 A Case Study: Analyze a Loan Chapter

More information

CMSC201 Computer Science I for Majors

CMSC201 Computer Science I for Majors CMSC201 Computer Science I for Majors Lecture 09 Strings Last Class We Covered Lists and what they are used for Getting the length of a list Operations like append() and remove() Iterating over a list

More information

STUDENT SOLUTIONS MANUAL

STUDENT SOLUTIONS MANUAL Student Solutions Manual (Page 1 of 211) STUDENT SOLUTIONS MANUAL to accompany An Introduction to Programming Using Visual Basic 2010, 8th Edition by David I. Schneider Student Solutions Manual (Page 2

More information

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals

VARIABLES. 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 information

Lab 4 - Input\Output in VB Using A Data File

Lab 4 - Input\Output in VB Using A Data File Lab 4 - Input\Output in VB Using A Data File Introduction You may want to read some data from an input file and write results into another output file. In these cases, it is useful to use a plain text

More information

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */

Language 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 information

Introduction to Computer Programming CSCI-UA 2. Review Midterm Exam 1

Introduction to Computer Programming CSCI-UA 2. Review Midterm Exam 1 Review Midterm Exam 1 Review Midterm Exam 1 Exam on Monday, October 7 Data Types and Variables = Data Types and Variables Basic Data Types Integers Floating Point Numbers Strings Data Types and Variables

More information

Chapter 17. Fundamental Concepts Expressed in JavaScript

Chapter 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 information

Learning VB.Net. Tutorial 10 Collections

Learning VB.Net. Tutorial 10 Collections Learning VB.Net Tutorial 10 Collections Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you enjoy it.

More information

COMP1730/COMP6730 Programming for Scientists. Data: Values, types and expressions.

COMP1730/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 information

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

Table of Contents Date(s) Title/Topic Page #s. Abstraction

Table of Contents Date(s) Title/Topic Page #s. Abstraction Table of Contents Date(s) Title/Topic Page #s 9/10 2.2 String Literals, 2.3 Variables and Assignment 34-35 Abstraction An abstraction hides (or suppresses) the right details at the right time An object

More information

Arithmetic Expressions in C

Arithmetic Expressions in C Arithmetic Expressions in C Arithmetic Expressions consist of numeric literals, arithmetic operators, and numeric variables. They simplify to a single value, when evaluated. Here is an example of an arithmetic

More information

CSC Web Programming. Introduction to JavaScript

CSC Web Programming. Introduction to JavaScript CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its

More information

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2.

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2. Class #10: Understanding Primitives and Assignments Software Design I (CS 120): M. Allen, 19 Sep. 18 Java Arithmetic } Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = 2 + 5 / 2; 3.

More information

Python Intro GIS Week 1. Jake K. Carr

Python Intro GIS Week 1. Jake K. Carr GIS 5222 Week 1 Why Python It s simple and easy to learn It s free - open source! It s cross platform IT S expandable!! Why Python: Example Consider having to convert 1,000 shapefiles into feature classes

More information

Lecture 3 Tao Wang 1

Lecture 3 Tao Wang 1 Lecture 3 Tao Wang 1 Objectives In this chapter, you will learn about: Arithmetic operations Variables and declaration statements Program input using the cin object Common programming errors C++ for Engineers

More information

Microsoft Visual Basic 2005: Reloaded

Microsoft 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 information

Angela Z: A Language that facilitate the Matrix wise operations Language Reference Manual

Angela Z: A Language that facilitate the Matrix wise operations Language Reference Manual Angela Z: A Language that facilitate the Matrix wise operations Language Reference Manual Contents Fei Liu, Mengdi Zhang, Taikun Liu, Jiayi Yan 1. Language definition 3 1.1. Usage 3 1.2. What special feature

More information

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Contents 1 Introduction...2 2 Lexical Conventions...2 3 Types...3 4 Syntax...3 5 Expressions...4 6 Declarations...8 7 Statements...9

More information

Additional Controls & Objects

Additional Controls & Objects Additional Controls & Objects November 8, 2006 Chapter 9 - VB 2005 by Schneider 1 General Tips & Tricks Now is the time to start thinking about the final exam Continue (start!) doing questions from the

More information

Visual C# Instructor s Manual Table of Contents

Visual 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 information

Chapter 2: Using Data

Chapter 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 information

MODULE 02: BASIC COMPUTATION IN JAVA

MODULE 02: BASIC COMPUTATION IN JAVA MODULE 02: BASIC COMPUTATION IN JAVA Outline Variables Naming Conventions Data Types Primitive Data Types Review: int, double New: boolean, char The String Class Type Conversion Expressions Assignment

More information

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.

VARIABLES. 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 information

CSE 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 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 information

Learning VB.Net. Tutorial 17 Classes

Learning VB.Net. Tutorial 17 Classes Learning VB.Net Tutorial 17 Classes Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you enjoy it. If

More information

VB FUNCTIONS AND OPERATORS

VB 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 information

Define a method vs. calling a method. Chapter Goals. Contents 1/21/13

Define a method vs. calling a method. Chapter Goals. Contents 1/21/13 CHAPTER 2 Define a method vs. calling a method Line 3 defines a method called main Line 5 calls a method called println, which is defined in the Java library You will learn later how to define your own

More information

Programming Language 2 (PL2)

Programming 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 information

2 nd Week Lecture Notes

2 nd Week Lecture Notes 2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous

More information

Information Science 1

Information 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 information

Module 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 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 information

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003 Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 Java Programs A Java program contains at least one class definition. public class Hello { public static void

More information

A Java program contains at least one class definition.

A Java program contains at least one class definition. Java Programs Identifiers Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 A Java program contains at least one class definition. public class Hello { public

More information

Learning Language. Reference Manual. George Liao (gkl2104) Joseanibal Colon Ramos (jc2373) Stephen Robinson (sar2120) Huabiao Xu(hx2104)

Learning Language. Reference Manual. George Liao (gkl2104) Joseanibal Colon Ramos (jc2373) Stephen Robinson (sar2120) Huabiao Xu(hx2104) Learning Language Reference Manual 1 George Liao (gkl2104) Joseanibal Colon Ramos (jc2373) Stephen Robinson (sar2120) Huabiao Xu(hx2104) A. Introduction Learning Language is a programming language designed

More information

Programming for Engineers Introduction to C

Programming 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 information

C++ PROGRAMMING. For Industrial And Electrical Engineering Instructor: Ruba A. Salamh

C++ PROGRAMMING. For Industrial And Electrical Engineering Instructor: Ruba A. Salamh C++ PROGRAMMING For Industrial And Electrical Engineering Instructor: Ruba A. Salamh CHAPTER TWO: Fundamental Data Types Chapter Goals In this chapter, you will learn how to work with numbers and text,

More information

CMSC201 Computer Science I for Majors

CMSC201 Computer Science I for Majors CMSC201 Computer Science I for Majors Lecture 09 Strings Last Class We Covered Lists and what they are used for Getting the length of a list Operations like append() and remove() Iterating over a list

More information

SAMS Programming A/B. Lecture #1 Introductions July 3, Mark Stehlik

SAMS Programming A/B. Lecture #1 Introductions July 3, Mark Stehlik SAMS Programming A/B Lecture #1 Introductions July 3, 2017 Mark Stehlik Outline for Today Overview of Course A Python intro to be continued in lab on Wednesday (group A) and Thursday (group B) 7/3/2017

More information

Introduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4.

Introduction 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 information

VARIABLES & ASSIGNMENTS

VARIABLES & ASSIGNMENTS Fall 2018 CS150 - Intro to CS I 1 VARIABLES & ASSIGNMENTS Sections 2.1, 2.2, 2.3, 2.4 Fall 2018 CS150 - Intro to CS I 2 Variables Named storage location for holding data named piece of memory You need

More information

Microsoft Visual Basic 2015: Reloaded

Microsoft 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 information

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

2.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 information

Introduction to TURING

Introduction to TURING Introduction to TURING Comments Some code is difficult to understand, even if you understand the language it is written in. To that end, the designers of programming languages have allowed us to comment

More information

Chapter 2 C++ Fundamentals

Chapter 2 C++ Fundamentals Chapter 2 C++ Fundamentals 3rd Edition Computing Fundamentals with C++ Rick Mercer Franklin, Beedle & Associates Goals Reuse existing code in your programs with #include Obtain input data from the user

More information

PRELIMINARY APPLE BASIC USERS MANUAL OCTOBER Apple Computer Company. 770 Welch Rd., Palo Alto, CA (415)

PRELIMINARY APPLE BASIC USERS MANUAL OCTOBER Apple Computer Company. 770 Welch Rd., Palo Alto, CA (415) PRELIMINARY APPLE BASIC USERS MANUAL OCTOBER 1976 Apple Computer Company. 770 Welch Rd., Palo Alto, CA 94304 (415) 326-4248 This is a PRELIMINARY manual. It will, most likley, contain errors, incorrect

More information

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment

More information

Visual Basic for Applications

Visual Basic for Applications Visual Basic for Applications Programming Damiano SOMENZI School of Economics and Management Advanced Computer Skills damiano.somenzi@unibz.it Week 1 Outline 1 Visual Basic for Applications Programming

More information

COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand

COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand COSC 236 Web Site I have decided to keep this site for the whole semester I still hope to have blackboard up and running, but you

More information

1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d.

1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d. Gaddis: Starting Out with Python, 2e - Test Bank Chapter Two MULTIPLE CHOICE 1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical

More information

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating

More information

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating

More information

Full file at

Full 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

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 10: OCT. 6TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 10: OCT. 6TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 10: OCT. 6TH INSTRUCTOR: JIAYIN WANG 1 Notice Assignments Reading Assignment: Chapter 3: Introduction to Parameters and Objects The Class 10 Exercise

More information

3 The Building Blocks: Data Types, Literals, and Variables

3 The Building Blocks: Data Types, Literals, and Variables chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating

More information

Lecture 2: Variables & Assignments

Lecture 2: Variables & Assignments http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 2: Variables & Assignments (Sections 2.1-2.3,2.5) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner,

More information

Jim Lambers ENERGY 211 / CME 211 Autumn Quarter Programming Project 2

Jim Lambers ENERGY 211 / CME 211 Autumn Quarter Programming Project 2 Jim Lambers ENERGY 211 / CME 211 Autumn Quarter 2007-08 Programming Project 2 This project is due at 11:59pm on Friday, October 17. 1 Introduction In this project, you will implement functions in order

More information

CSc Introduction to Computing

CSc 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 information

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments Basics Objectives Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments 2 Class Keyword class used to define new type specify

More information

Information Science 1

Information 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 information

Fundamentals of Programming. Lecture 3: Introduction to C Programming

Fundamentals of Programming. Lecture 3: Introduction to C Programming Fundamentals of Programming Lecture 3: Introduction to C Programming Instructor: Fatemeh Zamani f_zamani@ce.sharif.edu Sharif University of Technology Computer Engineering Department Outline A Simple C

More information

CT 229 Fundamentals of Java Syntax

CT 229 Fundamentals of Java Syntax CT 229 Fundamentals of Java Syntax 19/09/2006 CT229 New Lab Assignment Monday 18 th Sept -> New Lab Assignment on CT 229 Website Two Weeks for Completion Due Date is Oct 1 st Assignment Submission is online

More information

Lecture 1. Types, Expressions, & Variables

Lecture 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 information

Haskell Programs. Haskell Fundamentals. What are Types? Some Very Basic Types. Types are very important in Haskell:

Haskell Programs. Haskell Fundamentals. What are Types? Some Very Basic Types. Types are very important in Haskell: Haskell Programs We re covering material from Chapters 1-2 (and maybe 3) of the textbook. Haskell Fundamentals Prof. Susan Older A Haskell program is a series of comments and definitions. Each comment

More information

Converting a Lowercase Letter Character to Uppercase (Or Vice Versa)

Converting a Lowercase Letter Character to Uppercase (Or Vice Versa) Looping Forward Through the Characters of a C String A lot of C string algorithms require looping forward through all of the characters of the string. We can use a for loop to do that. The first character

More information

>>> * *(25**0.16) *10*(25**0.16)

>>> * *(25**0.16) *10*(25**0.16) #An Interactive Session in the Python Shell. #When you type a statement in the Python Shell, #the statement is executed immediately. If the #the statement is an expression, its value is #displayed. #Lines

More information

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types

Unit 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 information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: 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 information

Mr.Khaled Anwar ( )

Mr.Khaled Anwar ( ) The Rnd() function generates random numbers. Every time Rnd() is executed, it returns a different random fraction (greater than or equal to 0 and less than 1). If you end execution and run the program

More information

Chapter 3 Syntax, Errors, and Debugging. Fundamentals of Java

Chapter 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 information

Introduction to Data Entry and Data Types

Introduction 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 information

Lecture 2 Tao Wang 1

Lecture 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 information

Reserved Words and Identifiers

Reserved 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 information

Python for Analytics. Python Fundamentals RSI Chapters 1 and 2

Python for Analytics. Python Fundamentals RSI Chapters 1 and 2 Python for Analytics Python Fundamentals RSI Chapters 1 and 2 Learning Objectives Theory: You should be able to explain... General programming terms like source code, interpreter, compiler, object code,

More information

JAVA Programming Fundamentals

JAVA 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 information

Basics of Java Programming

Basics 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 information

Professor: Sana Odeh Lecture 3 Python 3.1 Variables, Primitive Data Types & arithmetic operators

Professor: Sana Odeh Lecture 3 Python 3.1 Variables, Primitive Data Types & arithmetic operators 1 Professor: Sana Odeh odeh@courant.nyu.edu Lecture 3 Python 3.1 Variables, Primitive Data Types & arithmetic operators Review What s wrong with this line of code? print( He said Hello ) What s wrong with

More information

Data Types and Variables in C language

Data Types and Variables in C language Data Types and Variables in C language Basic structure of C programming To write a C program, we first create functions and then put them together. A C program may contain one or more sections. They are

More information

VISUAL BASIC 2005 EXPRESS: NOW PLAYING

VISUAL BASIC 2005 EXPRESS: NOW PLAYING VISUAL BASIC 2005 EXPRESS: NOW PLAYING by Wallace Wang San Francisco ADVANCED DATA STRUCTURES: QUEUES, STACKS, AND HASH TABLES Using a Queue To provide greater flexibility in storing information, Visual

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

UNIT- 3 Introduction to C++

UNIT- 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 information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 05 / 31 / 2017 Instructor: Michael Eckmann Today s Topics Questions / Comments? recap and some more details about variables, and if / else statements do lab work

More information

Lecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos.

Lecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos. Lecture 2: Variables and Operators AITI Nigeria Summer 2012 University of Lagos. Agenda Variables Types Naming Assignment Data Types Type casting Operators Declaring Variables in Java type name; Variables

More information

Language Fundamentals

Language 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 information