Professional Documents
Culture Documents
Secondary
Memory/Storage
IFM100 – Lecture 01 [ 2 ]
Software
• Operating Systems
• Disk Operating System (DOS)
• Unix
• Windows
• Linux
• Compilers
• Application Software
IFM100 – Lecture 01 [ 3 ]
Programming Languages
• COBOL
• Turbo Pascal
• C++
• Object-oriented programming languages:
• Java
• Visual Basic
• C#
IFM100 – Lecture 01 [ 4 ]
The Problem Solving Cycle • Stepwise refinement
• Pseudo language / Design language
• Problem:
Understanding & • Simplify into number of steps
Analyse problem • Executed in the correct order
Develop
Debug program algorithm
(Pseudo Code)
Code program
IFM100 – Lecture 01 [ 5 ]
Algorithms
IFM100 – Lecture 01 [ 6 ]
What is a variables?
“a data item that may take on more than one value during the
runtime of a program”. [1]
[1] https://www.lexico.com/en/definition/variable
IFM100 – Lecture 01 [ 7 ]
Variables
IFM100 – Lecture 01 [ 8 ]
VeryVeryLongVariableName Private
Variable types
IFM100 – Lecture 01 [ 9 ]
Variable Assignment
IFM100 – Lecture 01 [ 10 ]
The If-Statement
IFM100 – Lecture 01 [ 11 ]
Event-Driven Programming
Reaction by VB
Event
IFM100 – Lecture 01 [ 12 ]
Design Process
IFM100 – Lecture 01 [ 13 ]
8 Parts of the Design
Before working in Visual Studio (placing controls on the form and writing the
code), we need to come up with a design that identifies:
IFM1A10 – Lecture 01 [ 2 ]
Designing the Solution to your First Problem
• Variables:
• Price – Integer
• VAT – Double
IFM100 – Lecture 01 [ 15 ]
• Interface:
• Be sure to refer to Inputs, Outputs, Actions & Events to design the
interface
VAT: txtPrice
txtVAT
• Pseudo Code:
• For btnVAT() sub:
• Get from the textbox txtPrice and Store in variable Price
• VAT Price * 15/100
• Display the value of the variable VAT in the textbox txtVAT
IFM100 – Lecture 01 [ 16 ]
• Test data:
IFM100 – Lecture 01 [ 18 ]
Forms
Text
Property:
My Program...
Name
Property:
frmGame
IFM100 – Lecture 01 [ 19 ]
Textboxes
Name
Property:
txtName
• A box that can be used to enable a user to enter text or to display text
• Important textbox properties:
• Name
• Prefix with txt
• e.g. txtName
• Text
• The value in the textbox itself (format of the value is always a String)
• Normally left blank
IFM100 – Lecture 01 [ 20 ]
Labels
Name
Property:
lblName
Text
Property:
Student Name:
IFM100 – Lecture 01 [ 21 ]
Command Buttons
Name
Text Property:
Property: btnAdd
Add
IFM100 – Lecture 01 [ 22 ]
Exercise 1:
Write a program to calculate a net salary where 30% tax is subtracted from the
gross salary.
IFM100 – Lecture 01 [ 23 ]
Solution to Exercise 1
• Input: Gross salary • Variables:
• Outputs: Net salary, Tax • Gross – Integer
• NetSal – Decimal (Double)
Events Actions
• Tax – Decimal (Double)
User clicks the • Calculate the Tax
command button – • Calculate the Net
btnCalc salary • Pseudo Code (for btnCalc() sub):
• Display both Net • Input the entered value into
salary and Tax variable Gross
• Tax ← Gross * 30/100
• Interface: frmSalary • NetSal ← Gross - Tax
• Display the value of the
Salary Calculator
variable Tax in the textbox
txtTax
Gross Salary: Calculate
• Display the value of the
Tax: txtGross variable NetSal in the textbox
txtTax btnCalc txtNet
Net Salary:
txtNet
IFM100 – Lecture 01 [ 24 ]
Solution to Exercise 1 Continued…
Test data:
IFM100 – Lecture 01 [ 22 ]