Cambridge International Catalogue 2024 - Final - Flipbook - Page 85
CAMBRIDGE INTERNATIONAL AS & A
LEVEL COMPUTER SCIENCE (9618)
Student’s Book
PRINT
DIGITAL
ENDORSED
D David Watson and Helen Williams
Develop computational thinking with clear explanations, illustrations and
diagrams, plus a Glossary of key terms ⸀ Offers a structured route through the
course and has been written by experienced authors and examiners ⸀
£49 ⸀00
Paperback 9781510457591
Available as
eBooks on
Boost eBook 9781398379923 2-year access
Look inside
Boost eBooks: Enable students to study anytime,
anywhere with interactive, downloadable versions
of the Student Books.
Find out more: hoddereducation.com/boost /ebooks
If you’re studying A Level Computer Science, then this book
contains all the information you’ll need to get through the
course.
5* Amazon review of Cambridge International AS & A Level Computer Science
Below, you will see the algorithm from the activity written using each of these
three methods.
9
Structured English
Pseudocode
Total ← 0
PRINT "Enter the number of values to average"
ACTIVITY
1 Ask for the number of values
9 ALGORITHM DESIGN AND PROBLEM-SOLVING
PRINT "Enter value"
4 Add the value to the Total in loop
INPUT Value
5 Calculate and output average
Total ← Total + Value
NEXT Counter
Flowchart
Average ← Total / Number
Start
Write down your
solution as an
algorithm in
structured English.
Total = 0
Counter = 1
Swap your algorithm
with another pair.
OUTPUT "Enter the
number of values
to average"
Test their algorithm
by following their
instructions to
draw a regular
polygon. Discuss
any similarities and
differences between
your solutions.
View sample resources
from our student’s book
Algorithms
In pairs, divide
the problem into
smaller parts,
identifying those
parts that are
similar.
FOR Counter ← 1 TO Number
3 Enter a value in loop
9.2
Look inside
You have been asked
to write an algorithm
for drawing regular
polygons of any size.
9
INPUT Number
2 Loop that number of times
INPUT
Number
OUTPUT
"Enter
value"
INPUT
Value
Total = Total + Value
Counter = Counter + 1
No
PRINT "The average of ", Number, " values is ", Average
9.2.2 Writing simple algorithms using pseudocode
Each line of pseudocode is usually a single step in an algorithm. The
pseudocode used in this book follows the rules in the Cambridge International
AS & A Level Computer Science Pseudocode Guide for Teachers and is set out
using a fixed width font and indentation, where required, of four spaces,
except for THEN, ELSE and CASE clauses that are only indented by two
spaces.
All identifier names used in pseudocode should be meaningful; for example,
the name of a person could be stored in the variable identified by Name. They
should also follow some basic rules: they should only contain the characters
A–Z, a–z and 0–9, and should start with a letter. Pseudocode identifiers
are usually considered to be case insensitive, unlike identifiers used in a
programming language.
It is good practice to keep track of any identifiers used in an identifier table,
such as Table 9.1.
Identifier name
StudentName
Description
Counter
Store a loop counter
StudentMark
Store a student mark
Store a student name
Counter >
Number?
▲ Table 9.1
Yes
Pseudocode statements to use for writing algorithms.
Average =
Total/Number
To input a value:
INPUT StudentName
OUTPUT "The average
of ", Number, " values
is ", Average
To output a message or a value or a combination:
OUTPUT "You have made an error"
End
▲ Figure 9.2
10
Return to the contents page
OUTPUT StudentName
OUTPUT "Student name is ", StudentName
11
READY TO ORDER?
hoddereducation ⸀com/Cambridge-al-cs
education@hachette ⸀co ⸀uk
83