Introduction to Computer Systems
Introduction to Computer Systems
Sciences
FSC 103
* Term assignment.
LECTURE 1
Documen Problem
tation Analysis
Development or Design /
Implementation
Model
• Problem Definition:
– Program to find the sum of the first 10
natural numbers
– Output = Pension
1. i 1
2. SUM 0
3. SUM SUM + i
4. i i + 1
5. If i > 10 GOTO Step
7
6. Else GOTO step 3
7. STOP
FSC 103 NOT FOR SALE PLEASE
FLOW CHART
• A flowchart is a diagram that
presents logical structures pictorially.
START / STOP
PROCESS
DECISION
INPUT / OUTPUT
PREDEFINED PROCESS
CONNECTOR
LOGIC FLOW
FSC 103 NOT FOR SALE PLEASE
Class Programming Example
Flowchart for Summing first 10 natural
numbers START
i = 1, SUM = 0
Is i YES
> STOP
10
NO
SUM = SUM + i
i=i+1
CHECK
CUSTOMER
STATUS
Order
NEW
CUSTOM
YES >
ER? N500
0?
NO NO YES
ACCEPT REFER TO
ORDER SUPERVISOR
* To be demonstrated in
class
Example
amount = 10000
fName = “ADE”
address = “Block 2, House 14, Ikeja”
FSC 103 NOT FOR SALE PLEASE
DATA TYPES IN VB
• Data type is the attribute of a
variable or field which determines
the kind of data it can hold.
Example: 2 * 8 + 10
– Relational Operators
These operators result in either True or
False. These can also be classified as
Boolean operation
FSC 103 NOT FOR SALE PLEASE
• Relational Operators include
greater than (>), less than (<), not equals
to (<>), less than or equals to (<=) etc.
• Logical Operators
– These include AND, NOT, XOR, OR, EQV
^ Exponential 2
NOT Negation 3
* and / Multiplication & Division 4
\ Integer Division 5
Mod Modulus 6
+ and - Addition or Subtraction 7
• Example
1. If logical expression is true then execute this
Else execute something else
End If
Do Until Do While
Example Example
a = 100, b = 10 a = 100, b = 10
Do Until ( a < b) Do While ( a > b)
b= a–b b= a–b
loop loop
These two loop statement accomplish the same thing and are example
of PRE-TEST loop statements.
hat is the test condition is tested first before executing the body of the l
FSC 103 NOT FOR SALE PLEASE
DO..LOOP CONT’D
Do Until Do While
Example Example
a = 100, b = 10 a = 100, b = 10
Do Do
b= a–b b= a–b
Loop Until ( a < b) Loop While ( a >
b)
Tool Bar
• Menu Bar
– Provides access to most of the commands that control the
programming environment (IDE), such as File, View, Tools etc.
• Tool Bar
– Collection of buttons that serve as shortcuts for executing
commands and controlling the VB IDE. It includes icons such as
OPEN File, SAVE, New Project etc
• Tool Box
– This gives easy access to common VB controls or tools such as
textbox, command button, list box, etc.
• Properties Explorer
– The properties window allows you to view and edit properties
associated with any particular form or control element.
• Project Window
– The project window shows all the files and folders included within the
project.
• Code Editor
– The code editor window is used to manually write codes / program
instructions for a control. There is a separate code editor window
associated with eachFSC 103 NOT FOR SALE PLEASE
form and control element.
COMMON WINDOWS FORM CONTROLS
VB
• Textbox: is used to accept information entered
by the user during execution or display an
information to the user.
• Problem Analysis:
– Input = radius of the circle
– Output = area & circumference
– Procedure:
• Area = Pi * radius * radius
• Circumference = 2 * Pi * radius
– Variables:
Start
• Dim rad as Integer
• Dim area as Double
Enter • Dim cirm as Double
RADIUS
– Sketch what the
application would
Area = Pi * RADIUS2 Output
Cirmf = 2* Pi * Area & look like
RADIUS Cirmf
Stop
• Documentation
Dim result = 0
TextBox3.Text = result
End Sub