Introduction to. A revised course with - Concise concepts - Hands on class work. - Plenty of examples - Programming exercises

Size: px
Start display at page:

Download "Introduction to. A revised course with - Concise concepts - Hands on class work. - Plenty of examples - Programming exercises"

Transcription

1 Introduction to 1 A revised course with - Concise concepts - Hands on class work TextBox1 - Plenty of examples - Programming exercises Copyright HKTA Tang Hin Memorial Secondary School 2012

2 Contents Chapter 1 Ideas of Programming What is a program? What is programming? What is a programming language? Compilers Names of some programming languages... 6 Chapter 2 Visual Basic 2010 Express Download Visual Basic 2010 Express Register Visual Basic 2010 Express within 30 days Your first project Create and save a new project Introduction to Visual Basic 2010 IDE Adding controls and code Open an existing project Structure of a Visual Basic 2010 project Microsoft Developer Network (MSDN) Chapter 3 Working with Controls Introduction to GUI programming in Visual Basic Controls Properties window Changing properties at runtime Assigning values to properties Add a comment to your source code Exercise Chapter 4 Events and Methods Introduction to events and methods Events Introduction to event procedures Adding an event procedure in Visual Basic Names and types of events The structure of an event procedure TextChanged events

3 4.3 Methods Exercise Chapter 5 Variables, Input and Output Variables Declaring variables with Dim statement Keywords and names of variables Giving values to variables in the Dim statement Declaring several variables in a single line Using variables to store values Scope of variables Introduction to InputBox and MsgBox InputBox MsgBox Miscellaneous examples Exercise Chapter 6 Operators and Expressions Arithmetic Operators Parentheses (singular: parenthesis) Concatenation Operators Operator Precedence Increment and Decrement Val function Mathematical Constants and Functions Miscellaneous Examples Exercise Chapter 7 Flow Control (1) Decision Making Relational Operators If...Then...Else Statement Multiple conditions with keyword ElseIf Official Syntax of If...Then...Else Statement Exercise Alphabetical Index

4 Introduction to Visual Basic - Book 1 Chapter 1 Ideas of Programming 1.1 What is a program? A program is a set of instructions that tells a computer how to do a task. With programs, computers can perform tasks and. 1.2 What is programming? Programming is the process of designing, writing, testing and debugging (remove mistakes) a program. To write a program, you need to know and solve the problem first. After solving the problem, you tell the computer how to solve the problem using a programming language. For example, if you need to write a program that calculates percentage changes, you should first solve the problem by obtaining the formula of percentage change. After that, you will write a program to do the task. In this course, Visual Basic.net the programming language you use. To get the idea of how to create a computer program, you may refer to the diagram at the right. Define the Problem (Note: after having a finished program, you can do an evaluation to look for possible improvements.) Evaluation Solve the Problem Testing and Debugging Write a Program 4

5 Chapter 1 Ideas of Programming 1.3 What is a programming language? In computers, instructions are stored in machine code, that each instruction (e.g. ADD, SUBTRACT, MULTIPLY, etc.) is given a unique number. Computers can understand machine code only! However, machine codes are very difficult to be understood by human. Therefore, programming languages, that are understandable by human, are created to bridge the gap. A programming language consists of a specification and an Trivia: The earliest programmers write programs in machine code, because programming languages are not available yet! implementation. The specification provides a definition of the programming language, and programmers write programs according to the specification. And the implementation is a translator: something that converts the program from the programming language into machine code. 1.4 Compilers Compilers are a type of translator that converts source code into an object program. The object program is stored in an executable file (.exe), which can be executed directly in a computer. The usage of a compiler can be summarized in the diagram below: Source Code (written in programming language) Compiler Object Program (written in machine code) Execution 5

6 Introduction to Visual Basic - Book Names of some programming languages Here are the names and characteristics of some programming languages. You are only required to remember the names of these programming languages. (The characteristics and example are provided for reference only.) Programming language BASIC (Beginner s All-purpose Symbolic Instruction Code) Logo Characteristics BASIC is designed to be easy-to-learn. It gradually evolved into modern programming languages, firstly QuickBasic, and then Visual Basic. Example program Output 10 FOR I=1 TO PRINT I*I 4 30 NEXT I Logo is known for drawing attractive graphics. It was used to teach programming in schools. Example program Output REPEAT 5 [FD 100 RT 144] (Note: FD = forward, RT = right turn. Only the star is drawn. The triangle is the cursor, pointing upwards.) Pascal Pascal was designed mainly to teach good programming style. Pascal is being taught in the HKDSE ICT syllabus. Some modern programs are also written in Pascal. Example program Output program example1; 1 var i : integer; 4 begin 9 for i := 1 to 5 do 16 begin 25 WriteLn(i*i); end; end. 6

7 Chapter 1 Ideas of Programming Programming language C++ JavaScript PHP Visual Basic.net Characteristics C++ is one of the most popular programming language (much more popular that Pascal). If you want to be a good programmer, C++ is a programming language that you must learn. C language, the predecessor of C++, is also widely used today. Example program Output #include <iostream> int main(int argc,char* argv[]) { for (int i=1; i<=5; i++) { cout << i*i << endl; } } JavaScript is the programming language available in a web browser, allowing dynamic user interaction in a web site. New web technologies, i.e. Ajax and HTML5 rely on JavaScript as the programming language. PHP is one of the most popular programming languages for a web server. With PHP you can dynamically generate web contents, and many other things, depending on user input. PHP is used in the Visual Basic.net is the programming language you are going to learn in this book. Visual Basic is the easiest programming language to learn if you want to program in Graphical User Interface (GUI). 7

8 Introduction to Visual Basic - Book 1 Chapter 2 Visual Basic 2010 Express 2.1 Download Visual Basic 2010 Express To download Visual Basic 2010 Express, you should search of Visual Basic 2010 in Google. After that, click the second link ( Visual Basic 2010 Express Microsoft Visual Studio ) (Note: in the PDF version of the file, you can simply click the link above.) Click Install Now to download the file vb_web.exe, and then follow the instructions. 2.2 Register Visual Basic 2010 Express within 30 days You must register your copy to use Visual Basic 2010 Express after the 30 days. For more information, press Help Register Product in the menu bar, and then follow the instructions (see the figure) to get a registration key. 8

9 Chapter 2 Visual Basic 2010 Express 2.3 Your first project Create and save a new project The first thing you do in Visual Basic is to start a new project. Follow the instructions below: 1. Click New Project. 2. Choose Windows Forms Application. 3. Give the project a name. 4. Press Okay. Use only common characters (letters, digits, space,. and _ ) in the project name. Otherwise, you may not be able to compile your program. 9

10 Introduction to Visual Basic - Book 1 Once you have created a project, you should immediately save the project by pressing Save All. 5. Choose File Save All in the menu bar. (Always save the project first!) 6. Choose a location for your project. (The location is only asked when you press Save All for the first time.) In Tang Hin, do not save the project to C drive. When you switch off the computer, everything in C drive will be deleted. 10

11 Chapter 2 Visual Basic 2010 Express Introduction to Visual Basic 2010 IDE After you create and save a project, you can see the screen like the figure below. This is known as an Integrated Development Environment, or simply IDE. An IDE contains different kinds of tools that help you to write programs, like source code editor, form designer, compiler, debugger and many other tools. Toolbox Form Designer Solution Explorer Properties Window If some of the above features is/are missing, you can click the buttons to show them. (See the figure above for the icons position on the screen.) 11

12 Introduction to Visual Basic - Book Adding controls and code Now we add some controls and code to the program. For your first program, follow the steps below: 1. Find Button in Toolbox, and then put it into the form. 2. Adjust the size of the form and the button. 3. Change the property Text of the button to Go. 4. Double click the button Go, you should see that some VB codes appear. 5. Insert a line of code shown in the right. 6. Run the program. (Press the green arrow or F5 in your keyboard.) Public Class Form1 Private Sub Button1_Click(...) Handles Button1.Click MsgBox("Hello") End Sub End Class Insert this line of code When you run the program, click the button Go (i.e. Button1), and then a message box containing the message Hello will be shown. Points to note: You MUST type all the words, including the punctuations, in exactly the same way. Extra spaces is NOT allowed between letters and digits. The words Public Class Form1, Private Sub, End Sub and End Class must be put in this order. It is too difficult to understand their meanings at this stage. The button is known as Button1 because you can find the words Button1 in its (Name) property. You can rename the button by setting this property. 12

13 Chapter 2 Visual Basic 2010 Express Open an existing project After you save a project, you can open the project later. To open the project, please follow the instructions here: 1. Click Open Project 2. Browse into the folder and you should see a Solution File. Choose this file and then click Open. Alternatively, you can simply use Windows Explorer to find the same Solution File. However, if you have installed two different versions of Visual Basic, this method may not work well. 13

14 Introduction to Visual Basic - Book Structure of a Visual Basic 2010 project The screenshot below illustrates the folder structure of a Visual Basic project. When you need to copy the project to another computer, or submit your homework or test in eclass, remember to ZIP all the contents of the base folder! The base folder (ZIP all contents of this folder when you need to submit your program to eclass.) Do not ZIP this one!!! bin: Find the executable file (.exe) here! My Project: Configuration and other files obj: Temporary file created when we compile the program. Safe to delete. Also, when you create a Form in Visual Basic IDE, three files are created. You can open the.designer.vb file with a text editor, in order to see the source code. However, no apparent action can be done in the.resx file. The three files related to Form1.vb. Do not delete any of them! 2.5 Microsoft Developer Network (MSDN) If you have a question, you can go to Microsoft Developer Network (MSDN) to find the information. For example, if you want to know the meaning of the keyword Then, just Google then vb msdn and you will find the information in MSDN. 14

15 Chapter 3 Working with Controls Chapter 3 Working with Controls 3.1 Introduction to GUI programming in Visual Basic When we create a new program, one of the first things to do is to create a user interface. The most common type of interface is called graphical user interface (GUI). You create a GUI program in Visual Basic by creating a new Windows Form Application. When you create a new project (see for details), you see an empty dialog box, which is known as a form, and also a Toolbox with a lot of controls (see the figure). You can add controls by dragging the controls into the form. When you finish, press F5 (the function button at the top of the keyboard) to run the program. 3.2 Controls In Visual Basic, users interact with the program using the controls in the form. Each control has its own use. Here are the types of controls we learn in this chapter: Type of control TextBox Label Button Functions A text box allows users to enter text (input). It can also be used to display results (output). A label provides visual cues to users, e.g. describe the meaning of the text box next to it. It can also used to display results (output). The program performs some actions when the user press or click the button. Forms and controls have properties, events, and methods. Together they make the forms and controls useful for programmers. 15

16 Introduction to Visual Basic - Book Properties window You can change the appearance of the controls (and form) by setting their properties in the properties window (see the figure). Put some controls into a form and change their properties. Don t forget the form! Here is a shortlist of the properties we use in the course: Property (Name) (design time only) * Text ForeColor BackColor Left Top Visible Enabled TextAlign (design time only) Font Use You give a name to the control, and use this name to refer to the control in your own source code. The text on the control, or the title of the form. The foreground colour (i.e. colour of the text) inside the control. The background colour (i.e. colour of the empty space) of the control/form. Horizontal position of the object, counted by the number of pixel relative to the left side of its parent. Vertical position of the object, counted by the number of pixel relative to the top side of its parent. Whether the control is visible to the user. Whether users can interact with the control. If not, the control is usually dimmed. The horizontal and vertical alignment of the text inside the control. The font used by the text in the control. (design time only) * Even though we say design time only, it is possible to change these properties during runtime. However, how to changing these properties in runtime is too difficult to be included in this course. For labels and buttons, there is a subtle difference with the Text property. Search UseMnemonic in Google for details. 16

17 Chapter 3 Working with Controls 3.4 Changing properties at runtime Properties of controls can be changed using the properties window (during design time) or by Visual Basic code (during runtime). Here is an example program that changes some properties of the form and the controls. To enter the code into Visual Basic IDE, you can double In Visual Basic, the word Color is spelt in American English (no U ). click Button1 in design view. Can you guess what will happen after Button1 is clicked? (Note: Me refers to the form.) Example Public Class Form1 Changing properties at runtime Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Me.Text = "Button1 Pressed!" Me.BackColor = Color.Pink Label1.Text = "Name" Label1.BackColor = Color.Green Label1.ForeColor = Color.Yellow Label1.Top = 80 TextBox1.Text = "Sarah" TextBox1.BackColor = Color.Red TextBox1.Enabled = False TextBox1.Left = 20 End Sub End Class Button1.Visible = False 17

18 Introduction to Visual Basic - Book Assigning values to properties Different properties accept values of different data types. Please see the table below: Name of property Data type Example Text String Me.Text = "Title of the Window" ForeColor Color * Label1.ForeColor = Color.Red BackColor Color TextBox1.BackColor = Color.Green Left Integer Me.Left = 100 Top Integer Label1.Top = 234 Visible Boolean (True/False) Button1.Visible = True Enabled Boolean (True/False) TextBox1.Enabled = False Note: A string is enclosed in a pair of double quotes (""). If you want to have the " character inside a string, type that character twice. E.g. "She said ""hello"" to me." Class Work 3.5 Write down a Visual Basic statement for each of the following operation. Operation Change the background colour of the TextBox1 to blue. Make Button2 disappear. Set the title of the form to New Document Change the colour of the text in Label1 to yellow. Move Button1 that Button1 is vertically aligned with Button2. (Assume that the heights of both buttons are the same.) VB statement * For a list of the colours available, search for System.Drawing.Color in Google. 18

19 Chapter 3 Working with Controls 3.6 Add a comment to your source code After you write some source code, you should also write some comments in your program. Comments in Visual Basic start with a single quote ('), which is followed by any text you want. Please see the following example: Example Comments Public Class Form1 ' This is a comment that occupy for a whole line Private Sub Button1_Click(...) Handles Button1.Click TextBox1.Text = "Sarah" ' This is another comment TextBox1.BackColor = Color.Red End Sub End Class It is easy to understand the program if there are only a few lines of source code. However, after writing 100 or even 1000 lines of source code, it will very difficult to understand the logic behind the source code without reading the comments. Exercise 3 1. Write a program with two controls: Button1 and TextBox1. When Button1 is clicked, the following things should happen: (a) TextBox1 is disabled, (b) The background colour of TextBox1 becomes yellow, (c) Button1 becomes visible, and (d) The form s background colour becomes white. 2. Identify the mistakes in the following source code. There is one mistake in each line. (Note: There are no mistakes with the words Me, Label1, Button1 and TextBox1.) Me.Title = "Title of the form" Label1.BackColor = Colour.Green Button1.Visible = Ture TextBox1.Enable = False TextBox1.Text = Very good! 19

20 Introduction to Visual Basic - Book 1 Chapter 4 Events and Methods 4.1 Introduction to events and methods Besides working with properties, you need to use events and methods to communicate with the controls. 4.2 Events When the user does some action in the form (e.g. click a button), an event is raised or triggered. You can write a procedure in your Visual Basic program to handle the event, and that procedure will be executed every time the user does the same action. Some Action (e.g. the user clicks a button) Raise an Event Execute an Event Procedure Introduction to event procedures In the previous chapters, you have seen something like the following excerpt: Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click [Add your code here] End Sub The excerpt above is an event procedure, i.e. a procedure that handles an event. When Button1 is clicked, the event Button1.Click is handled by the procedure Button1_Click, and the code inside is executed. The user clicks Button1 Raise the event Button1.Click Execute procedure Button1_Click 20

21 Chapter 4 Events and Methods Adding an event procedure in Visual Basic Method1 Double click the needed item in a form A quick method to add an event procedure is to double click the related control in the form designer. The following events will be created: Type of control / form Event When the event is raised Form Load When the form is displayed for the first time Button Click When the Button is clicked Label Click When the Label is clicked TextBox TextChanged When the Text property of the TextBox is changed Method2 Select the event in the source code window If you want to create other event procedures, then you need to select the list in the source code view. First, select the control at the left, and then select the event at the right. Note: To add events to Form1, select (Form1 Events) instead of Form1. 21

22 Introduction to Visual Basic - Book Names and types of events The most commonly used events of are Load and Click. Here is a shortlist of events we use in this course: Name of event Load Click DoubleClick * TextChanged MouseEnter MouseLeave When the event is raised Before a form is displayed the first time. In most cases, this is when the program starts running. When the user clicks a form or control (e.g. Button). When the user double clicks certain kinds of controls (e.g. Form, Label, TextBox). Note: A Button does not raise the DoubleClick event. When the content of the Text property is changed (either by user input or by Visual Basic.net code.) When the mouse enter a form or control When the mouse leaves a form or control We identify an event by connecting the name of the control and the name of the event using a dot symbol, e.g. Button1.Click, TextBox2.TextChanged, etc. Events related to the form are prefixed by Me or MyBase, e.g. MyBase.Load, Me.Click, Me.MouseEnter, etc. Class Work Identify the events raised by the actions below: Action Execute a program Click Button1 The text inside TextBox1 is changed The mouse cursor leaves Label3 Event raised * Only some types of controls raises DoubleClick events. For details, see TextChanged events are also raised when the form is created, before the Load event is raised. Open Form1.designer.vb in a text editor to see the reason behind. Careless implementation of TextChanged events always causes runtime errors. It is okay to use either Me.Load or MyBase.Load 22

23 Chapter 4 Events and Methods The structure of an event procedure You can look at the following example for the structure of an event procedure. Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click [Add your code here] End Sub Now the code is explained part by part: Part Private Sub Button1_Click (sender As System.Object, e As System.EventArgs) Handles Button1.Click End Sub Meaning Declare a procedure The name of the procedure. The default is the name of the event, with. changed to _. You can change this name by yourself. Currently unimportant. Usually abbreviated as ( ) in this book The event or events to handle. Change this to something like Handles Button1.Click, Button2.Click, Button3.Click to handle multiple events in the same procedure Marks the end of the event procedure TextChanged events A correct implementation of TextChanged events is provided here without explanation. You should read this section again after you finish Chapter 7. Public Class Form1 Dim loaded As Boolean = False Private Sub Form1_Load(...) Handles MyBase.Load loaded = True End Sub Private Sub TextBox1_TextChanged(...) Handles TextBox1.TextChanged If Not loaded Then Exit Sub ' Add your code below End Sub Private Sub TextBox2_TextChanged(...) Handles TextBox2.TextChanged If Not loaded Then Exit Sub ' Add your code below End Sub End Class 23

24 Introduction to Visual Basic - Book Methods A method is a procedure that exists inside the control. You invoke methods to do something with a control. Sometimes it is possible to the same thing using either properties or methods. For example, the statements Form2.Visible = True (setting a property) and Form2.Show() (invoke a method) do the same thing. Here is the list of methods we learn in the course: Control Method Meaning Example [All] Hide Hide a control/form. Form2.Hide() [All] Show Show a control/form. Form2.Show() Form ShowDialog Show a form as a modal dialog box. Form2.ShowDialog() (A modal form must be closed or hidden before you can continue working with the rest of the application.) Form Close Close a form. The program ends when the startup form (usually Form1) is closed. TextBox AppendText Add some text to the end of the current text in the text box. TextBox Paste Paste some text to the cursor/selection of the text box. Me.Close() TextBox1.AppendText("Hello") TextBox1.Paste("Hello") Example Public Class Form1 AppendText and Paste methods Private Sub ButtonAppendText_Click(...) Handles ButtonAppendText.Click TextBox2.AppendText(TextBox1.Text) End Sub Private Sub ButtonPaste_Click(...) Handles ButtonPaste.Click TextBox2.Paste(TextBox1.Text) End Sub End Class Note: When you run the example, you should note the way computer join strings. No extra spaces are added by the computer! 24

25 Chapter 4 Events and Methods Example Form1.vb Public Class Form1 Multiple forms (try the buttons and text box yourself) Private Sub ButtonShow_Click(...) Handles ButtonShow.Click Form2.Show() End Sub Private Sub ButtonShowDialog_Click(...) Handles ButtonShowDialog.Click ' Note: a runtime error will occur i f Form2 is already visible Form2.ShowDialog() End Sub End Class Form2.vb Public Class Form2 Private Sub ButtonClose_Click(...) Handles ButtonClose.Click Me.Close() End Sub End Class Class Work 4.3 Write down Visual Basic statements for each of the following operation. Operation Append Hello! to TextBox1. Show Form3 as a modal dialog box. Show Form2 as a modal dialog box. The current form is hidden until Form2 is closed. VB statement(s) A hidden form is NOT closed. If the startup form is hidden, then the program may not end properly! (If it happens, you can terminate the program in the Task Manager.) 25

26 Introduction to Visual Basic - Book 1 Exercise 4 1. Write a program with two controls: Button1 and Button2. When Button1 is clicked, the following things should happen: (a) Button1 is disabled, (b) The text in Button1 becomes Disabled!!!, (c) Button2 becomes visible, and (d) The form s background colour becomes pink. And when Button2 is clicked, the following things should happen: (a) Button1 is enabled, (b) The text in Button1 goes back to Button1, (c) Button2 becomes invisible, and (d) The form s background colour becomes yellow. Make sure your source code is inputted in the correct events! Check for spelling mistakes! 2. Write a program to tease the user with a button labelled Click Me. In this program, the user cannot press a button because the following happens: When the mouse is inside the form, the button is disabled. When the mouse is outside the form, the button is enabled again. To verify that the tease works, you should also add a Click event for the button, which changes the text of the button to Clicked. (Note: I would like to replace the words form by button in the question, but the program created that way does not work properly.) 26

27 Chapter 5 Variables, Input and Output Chapter 5 Variables, Input and Output 5.1 Variables In Visual Basic, you use variables to store values. Variables have a name and a data type Declaring variables with Dim statement Before you use a variable, you should tell Visual Basic in advance, using the Dim statement: Dim variablename [As type] The data type of the variable can be one of the following: Data type Description Integer Integer (between -2,147,483,648 through 2,147,483,647) Single Single-precision floating-point (about 7 significant figures). Double Double-precision floating-point (about 16 significant figures). Boolean True or False String Text (holds your name, ID card number, etc ) Example Dim statements Dim score As Integer Dim weight As Double Dim finished As Boolean Dim name As String Class Work Determine the correct data type(s) for the following data, and write down a Dim statement, where the name of the variable is the underlined word. Description of data Data type Dim statement The height of a student (in cm). The marks of a test. The academic grade of a student. The age of your father. Whether you are wealthy. 27

28 Introduction to Visual Basic - Book Keywords and names of variables Some words have special meanings in Visual Basic, such as Dim, As, Integer, Double, Boolean, and String. These words are known as keywords, or reserved keywords. The list of keywords in Visual Basic 2010 can be found in The name of a variable cannot be any of the reserved keywords. In addition, it must obey the following rules: Visual Basic is not case sensitive, e.g. ScOrE and score are the same name in Visual Basic. It must begin with an alphabetic character or an underscore (_). It must only contain alphabetic characters, decimal digits, and underscores. It must contain at least one alphabetic character or decimal digit. It must not be more than 1023 characters long Giving values to variables in the Dim statement We can assign a value to a variable in the same Dim statement. This is a good practice in programming because it eliminates potential mistakes. Example Dim statements with initial values Dim score As Integer = 0 Dim weight As Double = Dim finished As Boolean = False Dim name As String = "Chan Tai Man" Declaring several variables in a single line We can declare several variables in a single Dim statement. However, in Visual Basic, we cannot assign a value to these variables at the same time. Example Dim statements with several variables in one line Dim a, b, c As Single, x, y As Double, i As Integer ' a, b, and c are all Single; x and y are both Double 28

29 Chapter 5 Variables, Input and Output Using variables to store values We can assign a value to a variable with the equal sign =. Once a new value is stored in the variable, the old value is forgotten. See the example below: Example Use of variables Dim x, y As Integer x = 5 ' x is set to 5 y = 3 ' y is set to 3 x = 2 ' x becomes, y is unchanged y = x + 2 ' y becomes (x+2)=(2+2)=4, x is unchanged x = y + 3 ' x becomes (y+3)=(4+3)=7, y is unchanged Class Work With reference to the programs below, write down the values of the variables after the execution of each of the statements. Program Value of a Value of b Value of t Dim t As Integer Dim a As Integer = 2 2 Dim b As Integer = t = a a = b b = t Program Value of p Value of q Dim p As Double = 3 Dim q As Double = 4.5 q = p p = 2 p = (p + q) / 2 q = (p - q) / 2 29

30 Introduction to Visual Basic - Book Scope of variables The variable can be declared inside the Class or inside a Sub procedure. The variable is only effective inside the Class or Sub structure. Once the given structure finishes execution, the variable is deleted and its value is forgotten. Here is an example: Variable inside Class Public Class Form1 Dim x As Integer = 20 Private Sub Button1_Click(...) Handles Button1.Click x = x + 10 'increase x by 10 Label1.Text = x End Sub End Class After execution of Sub Button1_Click, the new value of x is remembered. Therefore, x is increased by 10 every time we click the button. Variable inside Sub Public Class Form1 Private Sub Button1_Click(...) Handles Button1.Click Dim x As Integer = 20 x = x + 10 'increase x by 10 Label1.Text = x End Sub End Class After execution of Sub Button1_Click, the new value of x is forgotten because x is declared inside Sub Button1_Click. Therefore, x becomes = 30 every time we click the button. If a variable exists both inside and outside the sub, the variable inside the sub is used. You may also declare variable inside an If Then Else statement (see chapter 7) or other statement blocks. Like the case with Sub procedure, those variables will be forgotten after the statement block finish execution. 30

31 Chapter 5 Variables, Input and Output Class Work The following is a program with label Label1 and buttons Button1, Button2 and Button3. Public Class Form1 Dim x As Integer = 5 Private Sub Button1_Click(...) Handles Button1.Click Dim x As Integer x = 8 Label1.Text = x End Sub Private Sub Button2_Click(...) Handles Button2.Click End Sub Label1.Text = x Private Sub Button3_Click(...) Handles Button3.Click x = 12 Label1.Text = x End Sub End Class Now the program is run and the buttons is pressed step by step as follows. Determine the value of Label1.Text after each step: Step Action Value of Label1.Text 1 Run the program. 2 Click Button1. 3 Click Button2. 4 Click Button3. 5 Click Button1. 6 Click Button2. 31

32 Introduction to Visual Basic - Book Introduction to InputBox and MsgBox Besides using labels and textboxes, we can use InputBox and MsgBox to handle input and output. In this part, we only deal with the simplest way to handle input and output. The details will be discussed in the second term InputBox To use an InputBox to input a string, we use the following statement: variablename = InputBox("message") If you want to input a number, you should use the Val function to convert the string into a number, i.e. Without the Val function, a runtime error occurs if the user press Cancel in the InputBox. variablename = Val(InputBox("message")) Here is an example asking for your name using InputBox: * Example InputBox Dim s As String s = InputBox("What is your name?") * Starting from this chapter, there may be no Button1 and Button1.Click in the examples. You should create the button Button1 and the event Button1.Click yourself, and then input the code inside Button1.Click. 32

33 Chapter 5 Variables, Input and Output MsgBox To use MsgBox to display a message, we use the following statement: MsgBox("message") Here is an example using MsgBox: Example MsgBox MsgBox("This is a wonderful message!") If you want to check the value of a variable, you can add a MsgBox statement in your source code.. If you want to display a message with more than one line, see the example below. The & character join strings together, and vbcrlf is similar to the Enter key in the text editor. (Note: the example below should be typed in a single line.) Example Multiline MsgBox MsgBox("You Won!!!" & vbcrlf & vbcrlf & "You rolled a 6" & vbcrlf & "and the computer rolled a 5!") 33

34 Introduction to Visual Basic - Book Miscellaneous examples Example Calculate the product of two numbers Dim x, y, product As Double x = Val(InputBox("Input the first number.")) y = Val(InputBox("Input the second number.")) product = x * y MsgBox("Their product is: " & product) Exercise 5 1. Rewrite Example into a program that does not use InputBox and MsgBox. Use text boxes and labels instead. 2. Write a program that uses InputBox to input two numbers when the form is loaded. The numbers are stored into two variables. Now the user can press one of the four buttons, that each of the buttons does a basic arithmetic operation (i.e. +,, or ) * on the two numbers, and then display the results using a MsgBox. Note: Do not use any text boxes or labels in this question. 3. Suggest a name and a data type of the variable for each of the following. Meaning of variable Name of variable Data type The name of a student. The class of a student. The date of the computer examination. * The symbol can be typed by pressing Alt It means holding the Alt key and typing 0215 in the numeric keypad while the Alt key is held. Similarly, can by typed by pressing Alt

35 Chapter 6 Operators and Expressions Chapter 6 Operators and Expressions You can enter expressions in Visual Basic to do calculations. The expressions in Visual Basic are similar to what you type in your calculator, Casio fx-50fh. Operators in Visual Basic can be classified into arithmetic operators, (string) concatenation operators, relational operators and logical operators. The first two types are discussed in this chapter, while the others are discussed in the next chapter. 6.1 Arithmetic Operators Here is a list of the arithmetic operators in Visual Basic You should get yourself familiar with the operators \ and Mod before examinations. Operator Meaning Example Result + Addition Subtraction (unary) Negation -2-2 * Multiplication 3*8 24 / Division (floating point) 14/4 3.5 \ Integer division Note: Avoid decimals. They are rounded off in a strange way. 14\ \ Mod Find the remainder of division (decimals are okay) 10 Mod Mod ^ Exponentiation 3^4 81 Class Work 6.1 Evaluate the following expressions: VB expression Result VB expression Result * ^ 5 15 / 7 5 ^ 2 15 \ 6 3 ^ (5-2) 15 Mod 6 5 ^ (-2) 35

36 Introduction to Visual Basic - Book Parentheses (singular: parenthesis) Parentheses (or brackets) are used to force some parts of an expression to be evaluated before others. Do not forget to add a pair of parentheses. E.g. should be a/(b+c) but not a/b+c. Class Work 6.2 Convert the following expressions into Visual Basic code: Mathematical expression a = b + c VB statement ( ) 6.3 Concatenation Operators Concatenation is the operation joining two strings together. The strings are simply joined together into a single string. There are two concatenation operators in Visual Basic: + and &. The & operators is preferred because it is defined for strings only. Example: "Con" & "caten" & "ation" evaluates to "concatenation" Note: No space is added to the strings. Adding a number and a string by the + sign, e.g., "4" + 2, will produce a runtime error! 36

37 Lowest Highest Chapter 6 Operators and Expressions 6.4 Operator Precedence Similar to Mathematics expressions, the evaluation of expressions in Visual Basic is ordered by its operator precedence. Here is the list * : (Note: operators that are introduced in the future are also listed here.) 11 Exponentiation ^ 10 Unary identity and negation + 9 Multiplication and floating-point division * / 8 Integer division \ 7 Modulus arithmetic Mod 6 Addition and subtraction + 5 String concatenation & 4 Relational/comparison operators = <> < <= > >= 3 Negation Not 2 Conjunction And 1 Inclusive disjunction Or For operators in the same order of precedence, the calculations are done left-to-right. Class Work 6.4 Evaluate the following expressions: VB expression "con" & "cent" & "rated" 4 * 3 & 5 * / 2 * \ 2 * 3-35 Mod 3 ^ 3 Result * The operator precedence table above is only valid of Visual Basic. It is different for Excel. A unary operator has only one expression next to it. e.g. the sign in. 37

38 Introduction to Visual Basic - Book Increment and Decrement One of the most common operations in a program is to increase and decrease the value of a variable. See the following example for an idea. ' Assigns the value 10 to the variable. applessold = 10 ' The following statement increments the variable. applessold = applessold + 1 ' The variable now holds the value 11. In the previous example, the statement applessold = applessold + 1 increase the value of the variable applessold by 1. You may also write applessold += 1 instead. In the example, += is an assignment operator, which add a certain value to a variable. -=, *=, /=, \=, ^= and &= are having similar meanings. Class Work 6.5 Express the following actions into Visual Basic code: Action Increase x by 100 Decrease y by 5 Multiple product by -3 Add "sugar" to the end of the str1 Move the form downwards by 3 pixels Move the form to the left by 20 pixels VB statement 6.6 Val function In Chapter 5, you have learnt to use the Val function to convert strings into numbers. We use the Val function in either of the following ways: variablename = Val(InputBox("message")) variablename = Val(TextBox1.Text) We call Val a function because it returns a value that can be assigned to a variable. Similarly, InputBox is also a function. 38

39 Chapter 6 Operators and Expressions 6.7 Mathematical Constants and Functions Here is a list of mathematical constants and functions you will use in Visual Basic: Function Meaning Example Result Math.Sqrt Find the square root of a number. Math.Sqrt(4) 2 Math.Abs Math.Sign Absolute value (remove the negative sign). The sign of the number. 1 = positive, 0 = zero, -1 = negative Math.Abs(-4) 4 Math.Sign(-5) -1 Math.PI The value of. Math.PI Int (or Math.Floor) Fix (or Math.Truncate) Round down to the nearest integer. Find the integral part of a number. Int(2.3) Int(-2.3) Fix(2.3) Fix(-2.3) Math.Ceiling Round up to the nearest integer. Math.Ceiling(2.3) Math.Ceiling(-2.3) Math.Round Round off a number to an integer or a Math.Round(12.56) 13 specified number of decimal places. Math.Round(12.56,1) 12.6 (Note: The behavior of this function is a bit different from what you learn in Mathematics. See MSDN for details.) Math.Max Returns the larger of two numbers. Math.Max(2, 5) 5 Math.Min Returns the smaller of two numbers. Math.Min(2, 5) 2 Class Work 6.7 Convert the following expressions into Visual Basic code: Mathematical expression VB statement ( ) 39

40 Introduction to Visual Basic - Book Miscellaneous Examples Example Find the value of a polynomial Public Class Form1 Private Sub Button1_Click(...) Handles Button1.Click Dim x As Double = Val(TextBox1.Text) LabelResult.Text = -x ^ 2 + x + 3 TextBox1 End Sub End Class Button1 LabelResult Example Cycling through 0 to 9 Public Class Form1 Private Sub Button1_Click(...) Handles Button1.Click Dim n As Integer = Val(Label1.Text) Label1.Text = (n + 1) Mod 10 End Sub End Class Label1 Button1 Example Public Class Form1 Marks Counter Private Sub ButtonPlus20_Click(...) Handles ButtonPlus20.Click Dim marks As Integer = Val(LabelMark.Text) LabelMarks marks = marks + 20 LabelMark.Text = marks ButtonPlus20 End Sub Private Sub ButtonMinus10_Click(...) Handles ButtonMinus10.Click Dim marks As Integer = Val(LabelMark.Text) marks = marks - 10 LabelMark.Text = marks End Sub End Class ButtonMinus10 40

41 Chapter 6 Operators and Expressions Exercise 6 1. Write a program to find the value of the n-th triangle number, i.e.. 2. Write a program to calculate the value of in. 3. Rewrite the programs in the previous questions, using InputBox for input and MsgBox for output. 4. Write a program similar to Example However, the number in the box should cycle backwards, i.e. 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 5. Write a program that calculates percentage changes. The program should be able to find the original value, the new value and the percentage change. (Hint: What are the formulas?) 6. Write a program with four buttons: up, down, left and right. When you press the button, the form moves itself by 10 pixels, to the direction indicated by the button. 41

42 Introduction to Visual Basic - Book 1 Chapter 7 Flow Control (1) 7.1 Decision Making A logical expression can give Boolean results, i.e. True or False. A computer can use these results to make decisions. 7.2 Relational Operators Relational operators (or comparison operators) are the equality signs and inequality signs in Mathematics. If the equality or the inequality is satisfied, then the result is True, otherwise the result is False. Here is the list of the relational operators: Operator Meaning Example Result Opposite = Equal to 9 = 11 > Greater than 11 > 9 < Less than 11 < 9 >= Greater than or equal to 15 >= 15 <= Less than or equal to 9 <= 15 <> Not equal to 9 <> 9 Class Work 7.2 Convert the following comparison into Visual Basic code: Comparison 1. Is Peter (PHeight) taller than Mary (MHeight?) 2. Is Linda s age (LAge) not equal to May s age (MAge)? 3. The passing mark is 50. Has Gigi (GMark) failed the test? 4. It is free to travel by MTR for a person with height 100 cm or below. Is it free for Kitty (KHeight) to travel by MTR? 5. Is X an even number? VB code 42

43 Chapter 7 Flow Control (1) 7.3 If...Then...Else Statement The If...Then...Else statement conditionally executes a group of statements, depending on the value of an expression. (See the flowchart below.) The basic If Then Else syntax is listed here. If condition Then Statement1 Statement2... Else Statement3 Statement4... End If Sometimes we do not want to execute anything if the condition is false. In this case, we can skip the keyword Else, i.e. If condition Then Statement1 Statement2... End If 43

44 Introduction to Visual Basic - Book 1 The following example shows the use of If...Then...Else statements: Example Pass or failure Dim marks As Integer Dim result As String marks = Val(InputBox("Enter the marks:")) If marks >= 50 Then result = "Pass" Else result = "Fail" End If MsgBox(result) start input marks marks>=50? No result="fail" Yes result="pass" In the above example, if the marks is more than or equal to 50, then the result is Pass. Otherwise (i.e. marks less than 50), the result is Fail. output result end 7.4 Multiple conditions with keyword ElseIf If you want to have more than two outcomes, you can add additional conditions using the keyword ElseIf (else and if together in one word). If condition1 Then Statement1... ElseIf condition2 Then Statement2... (more ElseIf conditionals if applicable) Else Statement3... End If The spelling of the word ElseIf is E-L-S-E-I-F, not E-L-S-E-L-F! 44

45 Chapter 7 Flow Control (1) To see how the keyword ElseIf works, see the example below: Example Grading the results Dim marks As Integer start Dim grade As String marks = Val(InputBox("Enter the marks:")) input marks If marks >= 80 Then grade = "A" ElseIf marks >= 70 Then marks>=80? Yes grade = "A" grade = "B" No ElseIf marks >= 50 Then grade = "C" marks>=70? Yes grade = "B" Else grade = "D" End If MsgBox("Your grade is: " & grade) No marks>=50? No Yes grade = "C" In this example, the marks are used to determine the grade. When we check for the second condition marks >= 70, we already know that marks >= 80 is false. Therefore, only people with marks from 70 to 79 get a grade of B. grade = "D" output grade (Note: In this example, the marks are integers. This is NOT true in Tang Hin, where the marks are correct to 2 decimal places.) end Class Work With reference to Example 7.4.1, please fill in the table below: Marks 80 Grade A B C D 45

46 Introduction to Visual Basic - Book Official Syntax of If...Then...Else Statement Here is the official syntax of the If Then Else statement. The parts inside [] are optional. If condition [ Then ] [ statements ] [ ElseIf elseifcondition [ Then ] [ elseifstatements ] ] [ Else [ elsestatements ] ] End If -or- If condition Then [ statements ] [ Else [ elsestatements ] ] When you enter your code into the Visual Basic IDE, it will do the following changes automatically: Add the missing keyword Then Change Else If into ElseIf Change EndIf into End If And here is an example of the single line syntax. The symbol : is used to separate multiple statements. (Note: you may use : outside the If Then Else statement.) If A > 10 Then A = A + 1 : B = B + A : C = C + B 46

47 Chapter 7 Flow Control (1) Exercise 7 1. Write a program that the user will enter the number. If, output A big number! in a label, otherwise output A small number!. 2. Write a program that the user will enter the amount of pocket money he/she spends per week. Then the program will output a message according to the table below: Pocket Money ($) Message 0 You didn't spend any money. Are you lying? >0 and <$100 Below average. What a good student! >=$100 and <$200 Average. >$200 Above average. Consider to spend less! 3. BMI Calculator: The Body Mass Index (BMI) is a method to see if you are overweight or underweight. Your program should receive two inputs: mass (in kg) and height (in cm). Calculate the BMI by to the formula. (Be careful with the unit!!!) Finally, your program should determine the result according to the following table: BMI Classification <18.5 Underweight Average Overweight >= 28 Obese 4. Write a program that the user will enter his/her marks in Chinese, English and Mathematics subjects. Then output the number of subjects that he/she has failed (i.e. marks less than 50). 47

48 Introduction to Visual Basic - Book 1 Alphabetical Index A AppendText (method) As (keyword) B BackColor (property) Boolean (data type) Button (control) C Class (keyword) Click (event) Close (method) code comment compiler... 5 concatenation control... 12, 15 D data type... 18, 27 design time Dim (statement) Double (data type) DoubleClick (event) E Else (keyword) ElseIf (keyword) Enabled (property) event event procedure F False (keyword) Font (property) ForeColor (property) form form designer G graphical user interface GUI... See graphical user interface H Hide (method) I IDE... See Integrated Development Environment If (keyword) If...Then...Else (statement) InputBox Integer (data type) Integrated Development Environment K keyword L Label (control) Left (property) Load (event) M machine code... 5 mathematical functions Me (keyword)... 17, 22 method Microsoft Developer Network.. 14 Mod (operator) MouseEnter (event) MouseLeave (event) MSDN... See Microsoft Developer Network MsgBox MyBase (keyword) N Name (property) New Project... 9 O object program... 5 Open Project operator precedence operators arithmetic operators assignment operators concatenation operators relational operators P parentheses Paste (method) procedure program... 4 programming... 4 programming language... 5 BASIC... 6 C implementation... 5 JavaScript... 7 Logo... 6 Pascal... 6 PHP... 7 specification... 5 Visual Basic.net... 7 Properties Window property R reserved keywords runtime S Save All scope of variables Show (method) ShowDialog (method) Single (data type) Solution Explorer source code... 5, 12 String (data type) Sub (keyword) T Text (property) TextAlign (property) TextChanged (event)... 22, 23 Then (keyword) Toolbox Top (property) translator... 5 True (keyword) U user interface V Val (function)... 32, 38 variable vbcrlf (constant) Visible (property) Visual Basic 2010 Express... 8 W Windows Form Application.. 9, 15 48

Introduction to. second print. Copyright HKTA Tang Hin Memorial Secondary School

Introduction to. second print. Copyright HKTA Tang Hin Memorial Secondary School Introduction to 1 VISUAL BASIC 2016 edition second print Copyright HKTA Tang Hin Memorial Secondary School 2016-17 Table of Contents. Preface....................................................... Chapter.......

More information

S.2 Computer Literacy Question-Answer Book

S.2 Computer Literacy Question-Answer Book S.2 C.L. Half-yearly Examination (2012-13) 1 12-13 S.2 C.L. Question- Answer Book Hong Kong Taoist Association Tang Hin Memorial Secondary School 2012-2013 Half-yearly Examination S.2 Computer Literacy

More information

Introduction to. Copyright HKTA Tang Hin Memorial Secondary School 2016

Introduction to. Copyright HKTA Tang Hin Memorial Secondary School 2016 Introduction to 2 VISUAL BASIC 2016 edition Copyright HKTA Tang Hin Memorial Secondary School 2016 Table of Contents. Chapter....... 1.... More..... on.. Operators........................................

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

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

A Complete Tutorial for Beginners LIEW VOON KIONG

A Complete Tutorial for Beginners LIEW VOON KIONG I A Complete Tutorial for Beginners LIEW VOON KIONG Disclaimer II Visual Basic 2008 Made Easy- A complete tutorial for beginners is an independent publication and is not affiliated with, nor has it been

More information

Overview About KBasic

Overview About KBasic Overview About KBasic The following chapter has been used from Wikipedia entry about BASIC and is licensed under the GNU Free Documentation License. Table of Contents Object-Oriented...2 Event-Driven...2

More information

VBScript: Math Functions

VBScript: Math Functions C h a p t e r 3 VBScript: Math Functions In this chapter, you will learn how to use the following VBScript functions to World Class standards: 1. Writing Math Equations in VBScripts 2. Beginning a New

More information

VISUAL BASIC 6.0 OVERVIEW

VISUAL BASIC 6.0 OVERVIEW VISUAL BASIC 6.0 OVERVIEW GENERAL CONCEPTS Visual Basic is a visual programming language. You create forms and controls by drawing on the screen rather than by coding as in traditional languages. Visual

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

Visual Basic Course Pack

Visual Basic Course Pack Santa Monica College Computer Science 3 Visual Basic Course Pack Introduction VB.NET, short for Visual Basic.NET is a language that was first introduced by Microsoft in 1987. It has gone through many changes

More information

Fundamentals: Expressions and Assignment

Fundamentals: Expressions and Assignment Fundamentals: Expressions and Assignment A typical Python program is made up of one or more statements, which are executed, or run, by a Python console (also known as a shell) for their side effects e.g,

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

5. Control Statements

5. Control Statements 5. Control Statements This section of the course will introduce you to the major control statements in C++. These control statements are used to specify the branching in an algorithm/recipe. Control statements

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

You will have mastered the material in this chapter when you can:

You will have mastered the material in this chapter when you can: CHAPTER 6 Loop Structures OBJECTIVES You will have mastered the material in this chapter when you can: Add a MenuStrip object Use the InputBox function Display data using the ListBox object Understand

More information

An overview about DroidBasic For Android

An overview about DroidBasic For Android An overview about DroidBasic For Android from February 25, 2013 Contents An overview about DroidBasic For Android...1 Object-Oriented...2 Event-Driven...2 DroidBasic Framework...2 The Integrated Development

More information

Fundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials

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

Full file at Excel Chapter 2 - Formulas, Functions, Formatting, and Web Queries

Full file at   Excel Chapter 2 - Formulas, Functions, Formatting, and Web Queries Excel Chapter 2 - Formulas, Functions, Formatting, and Web Queries MULTIPLE CHOICE 1. To start a new line in a cell, press after each line, except for the last line, which is completed by clicking the

More information

GUI Design and Event- Driven Programming

GUI Design and Event- Driven Programming 4349Book.fm Page 1 Friday, December 16, 2005 1:33 AM Part 1 GUI Design and Event- Driven Programming This Section: Chapter 1: Getting Started with Visual Basic 2005 Chapter 2: Visual Basic: The Language

More information

variables programming statements

variables programming statements 1 VB PROGRAMMERS GUIDE LESSON 1 File: VbGuideL1.doc Date Started: May 24, 2002 Last Update: Dec 27, 2002 ISBN: 0-9730824-9-6 Version: 0.0 INTRODUCTION TO VB PROGRAMMING VB stands for Visual Basic. Visual

More information

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence

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

Using Microsoft Excel

Using Microsoft Excel Using Microsoft Excel in Excel Although calculations are one of the main uses for spreadsheets, Excel can do most of the hard work for you by using a formula. When you enter a formula in to a spreadsheet

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

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

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

St. Benedict s High School. Computing Science. Software Design & Development. (Part 1 Computer Programming) National 5

St. Benedict s High School. Computing Science. Software Design & Development. (Part 1 Computer Programming) National 5 Computing Science Software Design & Development (Part 1 Computer Programming) National 5 VARIABLES & DATA TYPES Variables provide temporary storage for information that will be needed while a program is

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

COPYRIGHTED MATERIAL. Visual Basic: The Language. Part 1

COPYRIGHTED MATERIAL. Visual Basic: The Language. Part 1 Part 1 Visual Basic: The Language Chapter 1: Getting Started with Visual Basic 2010 Chapter 2: Handling Data Chapter 3: Visual Basic Programming Essentials COPYRIGHTED MATERIAL Chapter 1 Getting Started

More information

Lesson 3: Basic Programming Concepts

Lesson 3: Basic Programming Concepts 3 ICT Gaming Essentials Lesson 3: Basic Programming Concepts LESSON SKILLS After completing this lesson, you will be able to: Explain the types and uses of variables and operators in game programming.

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

Visual Basic 2008 Anne Boehm

Visual Basic 2008 Anne Boehm TRAINING & REFERENCE murach s Visual Basic 2008 Anne Boehm (Chapter 3) Thanks for downloading this chapter from Murach s Visual Basic 2008. We hope it will show you how easy it is to learn from any Murach

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

Departme and. Computer. CS Intro to. Science with. Objectives: The main. for a problem. of Programming. Syntax Set of rules Similar to.

Departme and. Computer. CS Intro to. Science with. Objectives: The main. for a problem. of Programming. Syntax Set of rules Similar to. _ Unit 2: Visual Basic.NET, pages 1 of 13 Departme ent of Computer and Mathematical Sciences CS 1408 Intro to Computer Science with Visual Basic.NET 4 Lab 4: Getting Started with Visual Basic.NET Programming

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

1 Information system An information system is the combination of technology(computers) and people that enable an organization to collect data, store them, and transform them into information Data Data

More information

BASIC ELEMENTS OF A COMPUTER PROGRAM

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

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple

More information

Tutorial 03 understanding controls : buttons, text boxes

Tutorial 03 understanding controls : buttons, text boxes Learning VB.Net Tutorial 03 understanding controls : buttons, text boxes Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple

More information

Full file at https://fratstock.eu Programming in Visual Basic 2010

Full file at https://fratstock.eu Programming in Visual Basic 2010 OBJECTIVES: Chapter 2 User Interface Design Upon completion of this chapter, your students will be able to 1. Use text boxes, masked text boxes, rich text boxes, group boxes, check boxes, radio buttons,

More information

Unit 3. Operators. School of Science and Technology INTRODUCTION

Unit 3. Operators. School of Science and Technology INTRODUCTION INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.

More information

Revision for Final Examination (Second Semester) Grade 9

Revision for Final Examination (Second Semester) Grade 9 Revision for Final Examination (Second Semester) Grade 9 Name: Date: Part 1: Answer the questions given below based on your knowledge about Visual Basic 2008: Question 1 What is the benefit of using Visual

More information

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007 CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007 Course Web Site http://www.nps.navy.mil/cs/facultypages/squire/cs2900 All course related materials will be posted

More information

Formulas and Functions

Formulas and Functions Conventions used in this document: Keyboard keys that must be pressed will be shown as Enter or Ctrl. Controls to be activated with the mouse will be shown as Start button > Settings > System > About.

More information

Statements and Operators

Statements and Operators Statements and Operators Old Content - visit altium.com/documentation Mod ifi ed by Rob Eva ns on Feb 15, 201 7 Parent page: EnableBasic Enable Basic Statements Do...Loop Conditional statement that repeats

More information

Unit 6 - Software Design and Development LESSON 3 KEY FEATURES

Unit 6 - Software Design and Development LESSON 3 KEY FEATURES Unit 6 - Software Design and Development LESSON 3 KEY FEATURES Last session 1. Language generations. 2. Reasons why languages are used by organisations. 1. Proprietary or open source. 2. Features and tools.

More information

Objectives. In this chapter, you will:

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

Developing Student Programming and Problem-Solving Skills With Visual Basic

Developing Student Programming and Problem-Solving Skills With Visual Basic t e c h n o l o g y Del Siegle, Ph.D. Developing Student Programming and Problem-Solving Skills With Visual Basic TThree decades have passed since computers were first introduced into American classrooms.

More information

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage:

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage: Discussion 1H Notes (Week 3, April 14) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 More on Arithmetic Expressions The following two are equivalent:! x = x + 5;

More information

Using Microsoft Excel

Using Microsoft Excel About Excel Using Microsoft Excel What is a Spreadsheet? Microsoft Excel is a program that s used for creating spreadsheets. So what is a spreadsheet? Before personal computers were common, spreadsheet

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

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ 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 information

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Hello, in this lecture we will learn about some fundamentals concepts of java.

More information

Objectives. 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++ 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 information

CSI Lab 02. Tuesday, January 21st

CSI Lab 02. Tuesday, January 21st CSI Lab 02 Tuesday, January 21st Objectives: Explore some basic functionality of python Introduction Last week we talked about the fact that a computer is, among other things, a tool to perform high speed

More information

Chapter 2: Basic Elements of C++

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

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

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

CHAPTER 4: MICROSOFT OFFICE: EXCEL 2010

CHAPTER 4: MICROSOFT OFFICE: EXCEL 2010 CHAPTER 4: MICROSOFT OFFICE: EXCEL 2010 Quick Summary A workbook an Excel document that stores data contains one or more pages called a worksheet. A worksheet or spreadsheet is stored in a workbook, and

More information

Using Microsoft Excel

Using Microsoft Excel Using Microsoft Excel Formatting a spreadsheet means changing the way it looks to make it neater and more attractive. Formatting changes can include modifying number styles, text size and colours. Many

More information

CHAD Language Reference Manual

CHAD Language Reference Manual CHAD Language Reference Manual INTRODUCTION The CHAD programming language is a limited purpose programming language designed to allow teachers and students to quickly code algorithms involving arrays,

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

Basic Computer Programming (Processing)

Basic Computer Programming (Processing) Contents 1. Basic Concepts (Page 2) 2. Processing (Page 2) 3. Statements and Comments (Page 6) 4. Variables (Page 7) 5. Setup and Draw (Page 8) 6. Data Types (Page 9) 7. Mouse Function (Page 10) 8. Keyboard

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

DOWNLOAD PDF MICROSOFT EXCEL ALL FORMULAS LIST WITH EXAMPLES

DOWNLOAD PDF MICROSOFT EXCEL ALL FORMULAS LIST WITH EXAMPLES Chapter 1 : Examples of commonly used formulas - Office Support A collection of useful Excel formulas for sums and counts, dates and times, text manipularion, conditional formatting, percentages, Excel

More information

EXCEL BASICS: MICROSOFT OFFICE 2010

EXCEL BASICS: MICROSOFT OFFICE 2010 EXCEL BASICS: MICROSOFT OFFICE 2010 GETTING STARTED PAGE 02 Prerequisites What You Will Learn USING MICROSOFT EXCEL PAGE 03 Opening Microsoft Excel Microsoft Excel Features Keyboard Review Pointer Shapes

More information

UNIT 2 USING VB TO EXPAND OUR KNOWLEDGE OF PROGRAMMING

UNIT 2 USING VB TO EXPAND OUR KNOWLEDGE OF PROGRAMMING UNIT 2 USING VB TO EXPAND OUR KNOWLEDGE OF PROGRAMMING UNIT 2 USING VB TO EXPAND OUR KNOWLEDGE OF PROGRAMMING... 1 IMPORTANT PROGRAMMING TERMINOLOGY AND CONCEPTS... 2 Program... 2 Programming Language...

More information

HOUR 4 Understanding Events

HOUR 4 Understanding Events HOUR 4 Understanding Events It s fairly easy to produce an attractive interface for an application using Visual Basic.NET s integrated design tools. You can create beautiful forms that have buttons to

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

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

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

SUM - This says to add together cells F28 through F35. Notice that it will show your result is

SUM - This says to add together cells F28 through F35. Notice that it will show your result is COUNTA - The COUNTA function will examine a set of cells and tell you how many cells are not empty. In this example, Excel analyzed 19 cells and found that only 18 were not empty. COUNTBLANK - The COUNTBLANK

More information

Operators. Java operators are classified into three categories:

Operators. Java operators are classified into three categories: Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.

More information

EXCEL BASICS: MICROSOFT OFFICE 2007

EXCEL BASICS: MICROSOFT OFFICE 2007 EXCEL BASICS: MICROSOFT OFFICE 2007 GETTING STARTED PAGE 02 Prerequisites What You Will Learn USING MICROSOFT EXCEL PAGE 03 Opening Microsoft Excel Microsoft Excel Features Keyboard Review Pointer Shapes

More information

Disclaimer. Trademarks. Liability

Disclaimer. Trademarks. Liability Disclaimer II Visual Basic 2010 Made Easy- A complete tutorial for beginners is an independent publication and is not affiliated with, nor has it been authorized, sponsored, or otherwise approved by Microsoft

More information

DEPARTMENT OF MATHS, MJ COLLEGE

DEPARTMENT OF MATHS, MJ COLLEGE T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,

More information

9. Elementary Algebraic and Transcendental Scalar Functions

9. Elementary Algebraic and Transcendental Scalar Functions Scalar Functions Summary. Introduction 2. Constants 2a. Numeric Constants 2b. Character Constants 2c. Symbol Constants 2d. Nested Constants 3. Scalar Functions 4. Arithmetic Scalar Functions 5. Operators

More information

Add Subtract Multiply Divide

Add Subtract Multiply Divide ARITHMETIC OPERATORS if AND if/else AND while LOOP Order of Operation (Precedence Part 1) Copyright 2014 Dan McElroy Add Subtract Multiply Divide + Add - Subtract * Multiply / Divide = gives the quotient

More information

By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program

By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program 1 By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program variables. Apply C++ syntax rules to declare variables, initialize

More information

C++ Support Classes (Data and Variables)

C++ Support Classes (Data and Variables) C++ Support Classes (Data and Variables) School of Mathematics 2018 Today s lecture Topics: Computers and Programs; Syntax and Structure of a Program; Data and Variables; Aims: Understand the idea of programming

More information

Your First Windows Form

Your First Windows Form Your First Windows Form From now on, we re going to be creating Windows Forms Applications, rather than Console Applications. Windows Forms Applications make use of something called a Form. The Form is

More information

IFA/QFN VBA Tutorial Notes prepared by Keith Wong

IFA/QFN VBA Tutorial Notes prepared by Keith Wong Chapter 2: Basic Visual Basic programming 2-1: What is Visual Basic IFA/QFN VBA Tutorial Notes prepared by Keith Wong BASIC is an acronym for Beginner's All-purpose Symbolic Instruction Code. It is a type

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

COMP Primitive and Class Types. Yi Hong May 14, 2015

COMP Primitive and Class Types. Yi Hong May 14, 2015 COMP 110-001 Primitive and Class Types Yi Hong May 14, 2015 Review What are the two major parts of an object? What is the relationship between class and object? Design a simple class for Student How to

More information

o Counter and sentinel controlled loops o Formatting output o Type casting o Top-down, stepwise refinement

o Counter and sentinel controlled loops o Formatting output o Type casting o Top-down, stepwise refinement Last Time Let s all Repeat Together 10/3/05 CS150 Introduction to Computer Science 1 1 We covered o Counter and sentinel controlled loops o Formatting output Today we will o Type casting o Top-down, stepwise

More information

Variables and Constants

Variables and Constants 87 Chapter 5 Variables and Constants 5.1 Storing Information in the Computer 5.2 Declaring Variables 5.3 Inputting Character Strings 5.4 Mistakes in Programs 5.5 Inputting Numbers 5.6 Inputting Real Numbers

More information

Getting started 7. Setting properties 23

Getting started 7. Setting properties 23 Contents 1 2 3 Getting started 7 Introduction 8 Installing Visual Basic 10 Exploring the IDE 12 Starting a new project 14 Adding a visual control 16 Adding functional code 18 Saving projects 20 Reopening

More information

Sample A2J Guided Interview & HotDocs Template Exercise

Sample A2J Guided Interview & HotDocs Template Exercise Sample A2J Guided Interview & HotDocs Template Exercise HotDocs Template We are going to create this template in HotDocs. You can find the Word document to start with here. Figure 1: Form to automate Converting

More information

Decisions, Decisions. Testing, testing C H A P T E R 7

Decisions, Decisions. Testing, testing C H A P T E R 7 C H A P T E R 7 In the first few chapters, we saw some of the basic building blocks of a program. We can now make a program with input, processing, and output. We can even make our input and output a little

More information

Program and Graphical User Interface Design

Program and Graphical User Interface Design CHAPTER 2 Program and Graphical User Interface Design OBJECTIVES You will have mastered the material in this chapter when you can: Open and close Visual Studio 2010 Create a Visual Basic 2010 Windows Application

More information

CHIL CSS HTML Integrated Language

CHIL CSS HTML Integrated Language CHIL CSS HTML Integrated Language Programming Languages and Translators Fall 2013 Authors: Gil Chen Zion gc2466 Ami Kumar ak3284 Annania Melaku amm2324 Isaac White iaw2105 Professor: Prof. Stephen A. Edwards

More information

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Introduction: PHP (Hypertext Preprocessor) was invented by Rasmus Lerdorf in 1994. First it was known as Personal Home Page. Later

More information

Learning the Language - V

Learning the Language - V Learning the Language - V Fundamentals We now have locations to store things so we need a way to get things into those storage locations To do that, we use assignment statements Deja Moo: The feeling that

More information

Getting started 7. Setting properties 23

Getting started 7. Setting properties 23 Contents 1 2 3 Getting started 7 Introducing Visual Basic 8 Installing Visual Studio 10 Exploring the IDE 12 Starting a new project 14 Adding a visual control 16 Adding functional code 18 Saving projects

More information

Agenda. First Example 24/09/2009 INTRODUCTION TO VBA PROGRAMMING. First Example. The world s simplest calculator...

Agenda. First Example 24/09/2009 INTRODUCTION TO VBA PROGRAMMING. First Example. The world s simplest calculator... INTRODUCTION TO VBA PROGRAMMING LESSON2 dario.bonino@polito.it Agenda First Example Simple Calculator First Example The world s simplest calculator... 1 Simple Calculator We want to design and implement

More information

This tutorial will teach you about operators. Operators are symbols that are used to represent an actions used in programming.

This tutorial will teach you about operators. Operators are symbols that are used to represent an actions used in programming. OPERATORS This tutorial will teach you about operators. s are symbols that are used to represent an actions used in programming. Here is the link to the tutorial on TouchDevelop: http://tdev.ly/qwausldq

More information

Welcome Application. Introducing the Visual Studio.NET IDE. Objectives. Outline

Welcome Application. Introducing the Visual Studio.NET IDE. Objectives. Outline 2 T U T O R I A L Objectives In this tutorial, you will learn to: Navigate Visual Studio.NET s Start Page. Create a Visual Basic.NET solution. Use the IDE s menus and toolbars. Manipulate windows in the

More information

Unit 6 - Software Design and Development LESSON 3 KEY FEATURES

Unit 6 - Software Design and Development LESSON 3 KEY FEATURES Unit 6 - Software Design and Development LESSON 3 KEY FEATURES Last session 1. Language generations. 2. Reasons why languages are used by organisations. 1. Proprietary or open source. 2. Features and tools.

More information

Chapter 2 Working with Data Types and Operators

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

C++ Basic Elements of COMPUTER PROGRAMMING. Special symbols include: Word symbols. Objectives. Programming. Symbols. Symbols.

C++ 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 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

COMS 469: Interactive Media II

COMS 469: Interactive Media II COMS 469: Interactive Media II Agenda Review Data Types & Variables Decisions, Loops, and Functions Review gunkelweb.com/coms469 Review Basic Terminology Computer Languages Interpreted vs. Compiled Client

More information