Cambridge IGCSE & O Level Computer Science Programming Book for Microsoft Visual Basic Sample

Page 37

We are working with Cambridge Assessment International Education towards endorsement of this title. Any references or material related to answers, grades, papers or examinations are based on the opinion of the author(s). 2  Programming constructs

Symbol

Notes

Process

Examples

A process within the system. The flowchart should show sufficient detail to indicate how the proposed process is to be achieved. Beware of making the process too generic.

average ← (A+B+C+D)/4

result ← A * B

Logic flow

Joins two operations.

LE

For example, if the system had to calculate an average value, a process entitled ‘Calculate Average’ would be too generic. It needs to indicate the inputs or other values used to calculate the average.

INPUT A, B

The arrowhead indicates the direction of the flow. Decision

A point in the sequence where alternative paths can be taken.

forward(100)

TRUE

Number > 10

M

P

The condition on which the flow is determined is written within the symbol. Where multiple alternatives exist, sequence flows are indicated by chained decision symbols. Each ‘FALSE’ condition directs to another decision.

result ←A * B

FALSE

FALSE

FALSE repeatIs×Input 4 =A

FALSE right(90) Is Input =B Is Input =C

OUTPUT result

TRUE

TRUE

TRUE

Table 2.3: Symbols used in a flowchart

KEY WORD

Use a flowchart to represent the process of calculating an estimated arrival time for an aeroplane journey.

condition: the criteria that are tested as part of the execution of the code. The condition will result in either a True or False answer when tested.

A

DEMO TASK 2.1

Solution

The steps in the process are:

Step 1   Obtain location of journey start and end airports.

S

Step 2   Obtain the distance between the two airports. Step 3   Calculate the time it will take to complete the journey. Step 4   Obtain the time the journey will start. Step 5   Calculate the estimated arrival time by adding the journey time to the start time. Step 6   Output the estimated arrival time.

25 Original material © Cambridge University Press 2021. This material is not final and is subject to further changes prior to publication.


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.