Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 26

10th

grade

Visual Basic
Computer Grade 10
PRAYER
Loving Father,
Come be with us today
Fill our hearts with joy
Fill our minds with learning
Fill our lessons with fun
Fill our friendships with kindness
Fill our school with love
Help us grow in love and kindness
more like Jesus everyday
Amen.
Writing an Algorithm,
Pseudocode, and Flowchart
“A good programmer is a good
planner”
Do you still remember the
steps in solving Math
problems?
Solving Programming Problems

0101010101
1101010110
Human 111001010101
PROBLEM Instructions SOLVE
110100011111
Program Code
0101010101
Process in Solving Programming Problems
PROBLEM

ANALYSIS

ALGORITH
M

LIBRARY CODING

COMPILER

LINKER

EXECUTION

OUTPUT
Library
is a collection of resources or routines used by computer programs

Algorithm
is a step-by-step procedure to solve problems.

Pseudocode
is a description of an algorithm using a natural language, which makes reading of program easier.

Flowchart
is a diagram representing the logical sequence in which a combination of steps or operaions is to
be performed.
Basic Symbols Used in
Flowcharting
1. Terminator

 this is used in declaring the beginning and the end of the flowchart.
 Labeled with the word “Start” or “End”

2. Input / Output

 this is used if the flowchart needs input from the user or output from a
process.
3. Process

 this is used to process data, normally composed of mathematical symbols

4. Decision

 if the procedure leads to a comparison, which involves logical or


relational operators and question that is answerable by a “Yes” or a “No”
5. On-page Connector

 is a connecting flowchart within the same page

6. Off-page Connector

 is a connecting flowchart on another page


7. Arrows

 declare the flow of the process


Advantages of Flowchart

1. The flow of the program is easily


understood.

2. It determines the validity of the processes


involved in the program

3. Debugging or correcting of errors


becomes less complicated.

4. It produces effective program


documentation.
Guidelines for Preparing a Flowchart

1. Determine the following


1. Data to be entered
2. Information to be produced
3. The way the data will be entered
4. The point when data will be given
5. The point when information will be
produced
2. There should only be one Start/Begin and
Stop/End processes.
3. Concentrate on the logic of the program.
4. Choose only the important steps. No need to
represent all steps in the flowchart
Examples
Read the two sides of a rectangle and
calculate its area
Algorithm
Step 1: Input Width, Length

Step 2: Area = Length x Width

Step 3: Print Area

Pseudocode

• Input the width (W) and length (L) of a rectangle.


• Calculate the area (A) by multiplying L with W
• Print A
Flowchart
Start

Input
W,L

A = W x L

Print
A

End
Convert the length in feet to
centimeter
Algorithm
Step 1: Input Lft

Step 2: Lcm = Lft x 30.48

Step 3: Print Lcm

Pseudocode

• Input the length in feet (Lft)


• Calculate the length in cm (Lcm) by multiplying Lft
with 30.48
• Print length in cm (Lcm)
Flowchart
Start

Input
Lft

Lcm = Lft * 30.48

Print
Lcm

End
Compute for the monthly paycheck of a salesperson at a
department store. The employee would receive a bonus
of Php 300.00 for each year if he/she has been with the
store for two years or less. If the employee has been with
the store for more than two years, the bonus is Php
500.00 for each year.
Algorithm
Step 1: Get the base salary

Get the number of years of


Step 2: service

Step 3:
 Calculate the bonus using the following formula:
• If(noofyearsofservice is less than or equal to two)
Bonus = 300 * noofyearsofservice
• Otherwise
Bonus = 500 * noofyearsofservice
 Calculate the paycheck using the following equation:
• Paycheck = base salary + bonus
Pseudocode

• Input base salary (bs)


• Input number of service per year (spy)
• Calculate the bonus using the following formula with the following
conditions:
 If(noofserviceperyear (spy) is less than or equal to two)
Equivalent of bonus is 300 multiplied by
noofserviceperyear (spy)
Otherwise, equivalent of bonus is 500 multiplied by
noofserviceperyear(spy)
• Calculate the paycheck using the equation value of:
 Paycheck is equivalent to the sum of basesalary (bs) and
bonus (b)
Start Flowchart
Input
bs 1

Input
spy
Bonus = 300*spy

N
If (spy <=2) Bonus = 500*spy Paycheck = bs + b

Y Print
Paycheck
1
End

You might also like