OBJECT ORIENTED PROGRAMMING
USING VB.NET
By:
Collinson Colin Agbesi
Recommended Textbooks
1. Mike Snell & Lars Powers; “Microsoft Visual Studio 2010
Unleash” Pearson Education, Inc.
2. Evangelos Petroutsos, “Mastering Microsoft Visual Basic
2010”, Wiley Publishing Inc.
MATHEMATICAL OPERATORS
An operator in a programming language is a symbol
that tells the compiler or interpreter to perform specific
mathematical, relational or logical operations and give
out a result. Operators are widely used in computer
programming to perform computations and calculations.
Some operators used in programming includes;
Arithmetic operators
Comparison / Relational operators
Logical operators
Compound operators
Increment operators
Decrement operators
Unary operators
MATHEMATICAL OPERATORS
Arithmetic operators: Arithmetic operations are
performed according to the rules of BODMAS in
mathematics.
The basic arithmetic operations includes;
Addition (+): Use to find sum
Subtraction (-): Use to find difference
Multiplication (*): Use to find product
Division (/): Use to find division
Modulo (%): Use to find remainder
The Modulo (%) is a special operator that is used to find
the remainder when a number divides another number.
MATHEMATICAL OPERATORS
Comparison / Relational operators: The comparison
or relational operators are used to compare two or more
values in programming.
The comparison operators includes;
Less Than (<)
Greater Than (>)
Less or Equal to (<=)
Greater or Equal to (>=)
Equal to (==)
Not Equal to (!=)
MATHEMATICAL OPERATORS
Logical operators: The logical operators are used to
perform logic and Boolean operations in programming.
The logical operators includes;
AND (&&)
OR (||)
NOT Gate (!)
NAND Gate ()
NOR ()
XOR ()
XNOR ()
MATHEMATICAL OPERATORS
Compound operators: The compound operators are a
composition of arithmetic operators used to perform
special functions in programming.
Some compound operators includes;
Add and Assign (+=): Used to add values and the
result is stored back into the same memory
Subtract and Assign (-=): Used to subtract values and
the result is stored back into the same memory
Multiply and Assign (*=): Used to multiply values and
the result is stored back into the same memory
Divide and Assign (/=): Used to divide values and the
result is stored back into the same memory
Example: X = X + 5; This can be written as X+=5;
Y = Y – 10; This can be written as Y-=10;
MATHEMATICAL OPERATORS
Increment operator: The increment operator is used to
add one to a value in memory.
Example:
X = X +1; This can be written as X+=1;
Y = Y+1; This can be written as Y+=1;
Decrement operator: The increment operator is used
to subtract one from a value in memory.
Example:
X = X -1; This can be written as X-=1;
Y = Y-1; This can be written as Y-=1;
MATHEMATICAL OPERATORS
Unary operators: The unary operator is used to
perform operations on a single operand or variable.
Some examples of unary operators includes;
Plus (+): The unary plus operator precedes its operand
and converts it into a positive number. E.g. +5, +12
Minus (-): The unary minus operator precedes its
operand and converts it into a negative number. E.g. -5
Ampersand(&): The unary ampersand operator
precedes its operand and is used to get the address
location of the variable. E.g. &X, &Y, &Name, &Age
THE END
T o b e c o n t i n u e d………………………