Slides
Slides
NET
Programming 511
Lecturer: Frans Rampai
Semester 1 2018
Section A: Introduction
Study Materials:
Programming 511 Learner guide( key)
YouTube Visual Basic Tutorial by thenewboston
Programming with Microsoft Visual Basic 2012
Study materials are not limited to the above mentioned.
Student Assessments
2 Tests
One Assignment
One Exam
Section A: Introduction
What is programming Language?
Compiler understandable set of instructions used to build a software.
Compiler: IDE sub software that validate the code written by the
programmer.
Types of programmers?
Backend and frontend , Frontend design the look of the software and
backend write the code.
Section A: Introduction
IDE-Integrated Developmet Environment
Section A: Introduction
• Two types of Applications: Console Application(no interface) and
Windows Forms Application(Drag and drop)
• How to create Console Application:Click File>New>Project>Visual
Basic>Console Application>then name your application and click OK.
Section A: Introduction
• How to create Windows Forms Application: Click
File>New>Project>Visual Basic> Windows Forms Application >then
name your application and click OK.
Section B: Variables and Data Types
• Variable= A name/character that store data.
• Data type specify the type of data that a variable is allowed to contain.
Data Types
Primitive Non-Primitive
String
Numeric Logical Character
Array
Boolean
Char Etc
Integer Floating-point
Byte Long
Error types:
• Runtime Error: e.g user denied access. Unavailable requested resource.
• Syntax Error: Wrong Language e.g Console.ReadLine(
• Logic Error: Lack of Console.ReadLine(). Wrong calculations.etc
Section D:Operators
• Maths Operators:
Addition(+), Multiplication( *), Division( /), Modulus(Mod), +=,*=,-=,/=
Examples: Output:
Sum=5
Output:
Remainder=1
Section D:Operators
• Conditional operators:
< less than
> Greater than
= Equal to
>= Greater than or equal to
<= Less than or equal to
<> Not equal to
Section D:Operators
• Logical Operators:
And
Or
Section D:Operators
• Program Flow: Compiler read the code from top to bottom.
Output?
Section E: Control Structures
• Control structures enable programs to make decisions.
• If statement:
If <condition> Then
statements
ElseIf <condition> Then
statements
Elsstatements
End If
Section E: Control Structures
If statement.
Section E: Control Structures
If statement
Section E: Control Structures
Nested If statement
Section E: Control Structures
Nested If statement
Section E: Control Structures
• Select statement: same as if statement
Select <selector>
Case 1
statement
Case 2
statement
Case Else
statement
End Select
Section F: Strings
• Concatenating string: combining strings
• We use & or + to concatenate two or more strings.
Output:
Section F: Strings
• Length Method: count characters including space
Section F: Strings
• Substring Method: Cut out part of string using index.
• CompareTo() Method. Output of 1 means the two strings compared have same number of
characters, 0 means compared strings are identical and -1 means the compared strings have
unequal characters.
Section G: Repetition/Loop Structures
• For Next Loop:
• Step Operator: specify the number of steps per For Next Loop, default
is 1.
Section G: Repetition/Loop Structures
• Exit For: Quit For Next Loop when condition is true.
Good Luck.