8.2.

1
DEFINING AND UNDERSTANDING THE
PROBLEM,
PLANNING AND DESIGNING
SOFTWARE SOLUTIONS
DEFINING AND UNDERSTANDING THE PROBLEM,
PLANNING AND DESIGNING SOFTWARE SOLUTIONS
 In planning a solution,
 You need to understand;
 The problem to be solved and
 How the solution will be used.
 In this topic, You will consider all aspects of the solution before starting
its implementation.

 The selection of data types and structures used in the solution of a
problem can have a huge impact on the effectiveness of that
solution.
 A variety of data types and structures are introduced in this topic and
appropriate algorithms should be developed and implemented that
make best use of these.
 As algorithms become more complex, there is a need for a
methodical top-down approach with progressive refinement of detail.
DEFINING AND UNDERSTANDING THE PROBLEM,
PLANNING AND DESIGNING SOFTWARE SOLUTIONS
 By the end of this topic, You will be able to;
 Describe and uses appropriate data types
 Describes the interactions between the elements of a
computer system
 Describes the effects of program language developments
on current practices
 Identifies the issues relating to the use of software solutions
 Investigates a structured approach in the design and
implementation of a software solution
 Use a variety of development approaches to generate
software solutions and distinguishes between these
approaches
 Use and develop documentation to communicate software
solutions to others.
DEFINING AND UNDERSTANDING THE PROBLEM,
PLANNING AND DESIGNING SOFTWARE SOLUTIONS
 Three steps to produce a solution to a problem:
 Understand the problem
 Work out a way to solve the problem
 Check the solution to the problem

UNDERSTANDING THE PROBLEM
8.2.1
Defining and understanding the problem,
Planning and designing software solutions
UNDERSTANDING THE PROBLEM
 Prior to designing or developing any solution, the
need for that solution must be fully understood.

 To understand the need for the solution we must
investigate the intended use of the software.
 What is the overall purpose?
 Who are the users?
 What environment will it be used in?
 What Information Technology will be required and
what is already available in the current environment?
 What data/information is the software intended to
use/produce/manipulate?
UNDERSTANDING THE PROBLEM
 To understand a software solution to be
developed several tools can be used to get an
idea of the softwares purpose and way in which
it can achieve its purpose.
 IPO Charts  Input, Process, Output.
 Decision trees
 System Flow Charts,
 Dataflow Diagrams,
 Context Diagrams,


UNDERSTANDING THE PROBLEM
 IPO – Charts
 It describes all data elements which enter the
system, the process that they will undergo, and
the data elements that will leave the system
 The creation of IPO charts require the problem in
the following way:
 What outputs are required to solve the problem?
 What inputs are required to produce those
outputs?
 What processes are required to transform the
inputs into the outputs?

UNDERSTANDING THE PROBLEM
 IPO – Charts
 An IPO chart helps in understanding the
relationship of a system by showing the relation of
the subsystem.
 For example, a software is required to calculate
the area of a square and rectangles, the IPO will
look as follows:
UNDERSTANDING THE PROBLEM
 Example of IPO chart in tabular form
 Scenario : Engadine High School decides to prepare reports for
student based upon grades and marks both.
The grades and marks range is respectively as follows: “A” grade
ranges from 100 to 80 marks, “B” grade ranges from 79 to 60, “C”
grade ranges from 59 to 50 and lastly “F” grade which is the
failure ranges form 49 to 0.
 The IPO chart looks as follows:
UNDERSTANDING THE PROBLEM
 IPO exercise
 Construct an IPO chart and add the correct
headings to each of the three columns. Divide
the chart into five rows. Use one row to analyse
each of the following problems into inputs,
processes and outputs:
 The addition of two numbers
 Buttering a slice of bread
 Using a music CD
 Opening a browser at a specific web site
 Turning on a computer and opening a database
program (assume a GUI interface)
ABSTRACTION/REFINEMENT
8.2.1
Defining and understanding the problem,
Planning and designing software solutions
ABSTRACTION/REFINEMENT
 Top-down design
 In abstraction and refinement of the
problem, top-down design is used to
group the “program specification “
into more manageable smaller series
of problem or modules.
 This approach; decomposition of
problem, is also referred to as;
 “Stepwise refinement” or
 Hierarchy chart.
ABSTRACTION/REFINEMENT
ABSTRACTION/REFINEMENT
 Top-down design
 A graphical or written description of step by step procedure
for the modules is called solution algorithm or program logic
 The program containing modules allows the structure to be
more clearly examined and tested at each stage of
development.
 The programmer will test the main program before the
modules are created.
 Once the main program is tested then the other modules will
be created and tested.
 This will be a step by step procedure, so that the error is
eliminated when the testing is done for each modules.
 The main program or algorithm will be a “ driver module”
ABSTRACTION/REFINEMENT
 Modification of an Existing Solution:
 In some situations most needs are met by the
existing software, and the source code and
development documentation are available yet
new features or requirements are still necessary.
 In this case the original softwares source code can
be modified to allow for the new requirements or
hot fixes patches or updates can be developed to
account for the new requirements leaving the
previous software still functional with new modules.
DATA TYPES
8.2.1
Defining and understanding the problem,
Planning and designing software solutions
DATA TYPES – NUMBERING
SYSTEMS
 Data representation
 The binary, octal and the hexadecimal system are
the number systems used to represent data.
 A digital computer only understands the binary
system.
 The binary system of numbers is used to represent
states in a computer logic circuit or computer
storage,
 Requires only two digits to represent all numbers (0
and 1)
 The number one represents „on‟ and 0 represents
„off‟.
DATA TYPES – NUMBERING
SYSTEMS
The storage device that is commonly used to
store data and how the digits are represented
are as follows:


Storage Device Where it is stored? How is Data represented?
Electronic Media The RAM inside the a
computer uses the
electrical state
In this device the „on‟ and
„off‟ is represents the digits
1 and 0
Magnetic Media Such as Hard disk which
uses magnetic spots
The data representation in
this device is in form of
magnetic polarisation e.g.
NS for 1, EW for 0
Optical device Such as Compact disks
which has pits
Th data in a compact disk
is represented in form of pits
to identify on and off.
The large pit represents 1
and small pit represents off.
DATA TYPES – NUMBERING
SYSTEMS
 Conversion to and from the binary system
 The binary system (binary code) is an arithmetic
system uses only digits 0 and 1 to represent all
numbers.
 In our normal counting one we have reached the
last single digit,
 We increase the second digit by one and reset the
single digit to 0.
 The same happens to binary
 For example show below the Binary representation
of the first ten counting numbers:
 Four volunteers please
DATA TYPES – NUMBERING
SYSTEMS
 Conversion to and from the binary system
 Base of two(2) binary system,
 Base two means each unit from right to left is two to the
power of;
 Starting from a power of zero, one, two, three...
 Investigate this with your calculator;
 Draw up a table as follows and calculate the answer
below;

2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0
2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0

128 64 32 16 8 4 2 1
DATA TYPES – NUMBERING
SYSTEMS
 Conversion to and from the binary system



 Using the above table, workout how you would represent your birth
date in binary given;
 the day as one number (8 bit)
 The month as one number (8bit) and
 The year as one number (10 bit)
 What is the maximum number of bits required to store the day for any
given birthday?
 What is the maximum number of bits required to store the month for
any given birthday?
 What is the maximum number of bits required to store the year for any
given birthday within one century from today?



2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0

128 64 32 16 8 4 2 1
DATA TYPES – NUMBERING
SYSTEMS
 Conversion to and from the binary system
 Decimal numbers to binary: Division Method
 The division method is the practically the best way to
convert any numbers into binary system.
 The number that is to be converted is divided by two
and then the answer from the division will be again
divide by 2 and so on until you reach to 0.
 As you are dividing the number to be converted into
binary;\
 The reminder of each step of division is written in R column,
 that will be ether 0 or 1.
 When there is no reminder then it is 0
 When there is then that‟s 1
DATA TYPES – NUMBERING
SYSTEMS
 Conversion to and from the binary system
 Try the decimal number of 102


 Convert the following
decimal values to binary;
 63, 75, 457, 985, 135, 642, 314

Number
(dec)
Remainder
(bin)
102 R
Number
(dec)
Remainder
(bin)
102 R
51 0
25 1
12 1
6 0
3 0
1 1
0 1
1 1 0 0 1 1 0
DATA TYPES – NUMBERING
SYSTEMS
 Conversion to and from the Octal number
System
 The octal number system is based on eight digits
to represent the number (base 8),
 which is used to convert into binary number of
0,1,2,3,4,5,6,7.
DATA TYPES – NUMBERING
SYSTEMS
 Conversion to and from the Octal number
System
 This system of conversion is easier when numbers
are converted into binary and then using these
binary number convert it to Octal
 This system of conversion requires binary to be
grouped into three equal groups by placing zero‟s
in front of the binary numbers, so that it can be
divided into three equal groups.
DATA TYPES – NUMBERING
SYSTEMS
 Conversion to and from the Octal number
System
 Converting the number 102:

Decimal Number 102
Binary Number 1100110
Tri-Grouped
Binary Number
001 100 110
Pad the binary number
with two zeros so all sets in
groups of three.
Binary (Dec/Oct)Number
001 1. One
010 2. Two
011 3. Three
100 4. Four
101 5. Five
110 6. Six
111 7. Seven
=146 (OCT)
DATA TYPES – NUMBERING
SYSTEMS
 Conversion to and from the Octal number System
 Convert the following decimal values (that you previously
converted to binary) into octal;
 63, 75, 457, 985, 135, 642, 314
 Remember
 Convert to tri-grouped binary (pad where necessary)
 Take each groups value and sequence together.


DATA TYPES – NUMBERING
SYSTEMS
 Conversion to and from the hexadecimal number System
 Base- 16 number system (Hexadecimal)

 In a hexadecimal 16 numbers are used to represent each
digit.
 This represents the values stored within a computer byte in
two halves (four bits).
 The four groups that hexadecimal binary system is divide is
called nibble.

 The hexadecimal has sixteen different combinations of 0‟s
and 1‟s. It also uses the letter‟s A to F to represent some of
the digits.
 To calculate the hexadecimal number we have to add
zero‟s or delete zero‟s in front of the binary number so that
the binary number can be divided into equal groups of four
DATA TYPES
 Conversion to and from the hexadecimal
number System
 So lets take the decimal value of 102,
 Which is 1 1 0 0 1 1 0, in binary and 146 in Octal
 And convert it to a Hexadecimal value...

DATA TYPES
NUMBERING SYSTEMS

 Conversion to and from the
hexadecimal number System
 Convert 102 (dec) to
Hexadecimal...
Decimal Number 102
Binary Number 1100110
Quad-Grouped
Binary Number
0110 0110
Pad the binary number
with a zero so all sets in
groups of four or as a
nibble!
Binary (Dec/Oct)Number
0001 1. One
0010 2. Two
0011 3. Three
0100 4. Four
0101 5. Five
0110 6. Six
0111 7. Seven
1000 8. Eight
1001 9. Nine
1010 A. Ten
1011 B. Eleven
1100 C. Twelve
1101 D. Thirteen
1110 E. Fourteen
1111 F. Fifteen
=66(HEX)
DATA TYPES – NUMBERING
SYSTEMS
 Conversion to and from the Octal number System
 Convert the following decimal values (that you previously
converted to binary and octal) into Hexadecimal;
 63, 75, 457, 985, 135, 642, 314
 Remember
 Convert to quad-grouped binary (pad where necessary)
 Take each groups value and sequence together.


DATA TYPES – NUMBERING
SYSTEMS
 Data Types – Numbering Systems
Data Representation Summary
 One digit in a binary number is called a bit.
 There are 8 bits when grouped together is called a byte.
 We have to reverse the process in order to convert the base
16 numbers in a hexadecimal into base 10 numbers.
 The process of calculating base 10 number‟s using the base
16 numbers:
 HEX number is 66
 So, a base 10 number is equal to the sum of each digit value X 16
to the power of the digit place value.
 66(HEX) = 6 x 16
1
+ 6 x 16
0
(DEC)


= 102 (DEC)
DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION
 When programming it‟s really important to declare all
variables that you want to use in a program.
 A variable declaration includes the following:
 Data type  Identifying the type of data that the variable will store.
 Identifier  variable‟s name.
 Initialisation  An assigned value (optional dependant on language).
 Termination  A character used to represent the end of the
declaration (Language and case dependant),
 In C++, all lines end in ;
 In Python, functions and other structures require a : to indicate the end
of the declaration.
 Variables are named memory locations that your programs can
be used to store values
 A constant in programming is a “hard coded” value it can be a
number, character, string etc, in order for it to change the code
must be changed.
DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION
 Data and instructions are stored in a computer system as strings of binary digits.
 “Different programming languages have different keywords for each of these basic types.
 For instance, in C++, it's string
 while in Java it's String”
 Data types can be categorised into variable or constant.
 The constant data type is the one that cannot be changed once the program has been
compiled unless you modify the program

 Many languages require that you declare variables before you use them.
 A declaration specifies the data type and the name of the variable.
 In C++;
 int number = 0 // In C++ the data type must be declared by stating it before the
variable, because of this it is not necessary to “initialise”, assign the value to
the variable.
 In Python
 number = 0 # In Python, the compiler interprets the data type by the initial
assignment it has been given, that is why it is necessary to “initialise”,
assign the value to the variable.

DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION
 Abstract data types
 The structures defining properties that are
independent of the computer system being stored
and used.
 Abstract data structures can be categorised into
two forms:
 Simple data type
 Structured data type

DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION
Simple data types;
Data Type Description Storage Requirements Python Example
Boolean Can store and hold one
of only two conditions
such as
true or false
Can be as small as a
processor storing a bit in
a single register
Character Represents a single
Alphanumeric value, e.g.
A or 8. Numbers stored
are as characters so
have NO mathematical
value other than their
encoded value
(e.g. ASCII)
One byte in primary
storage,
gives max 256 different
characters within one
set.
charVar = „A‟

charVar = „8‟
String A sequence of character
s, either as a literal
constant or as some kind
of variable.
A byte is stored for each
character in the string,
most languages allow
strings to use a variable
amount of memory for
string storage through
the use of dynamic
memory allocation.
StrVar = “My String”

strVar = “1 2 3 4 5 6 7 8”
Integer This is a numerical data
type. It rangers from + to
-, that is known as two
compliments
Stored as two bytes
(sixteen bits)
Unsigned:
From 0 to 65,535 [2
16
− 1]
Signed (Two compliment):
From −32,768 to 32,767,
[−(2
15
) to 2
15
− 1]
intVar = 65352

intVar = -32124
Floating point/real

This is designed to
presents
values between two
integers,
which are fractional + or
– in decimal point form.
Stored in two parts as an
exponent (1 byte) and
mantissa (3 byte) which is
4 bytes in total
floVar = 0.124

floVar = 17.458
DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION
 Structured Data Types;
 Structured data type configuration in a
collective way offers a convenient way of
representing data that is to be stored ,
 The structured data types called:
 Arrays
 Records
 The arrays and records overcome‟s the problem of
identifying each item that needs to be processed,
 The structured representation of data allows a
logical relationship by using the same identifier.
DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION
 Structured Data Types;
 Arrays & Lists
 An array is a list of similar variables and each of the like
variables is called an array element.
 The declaration of the array variables is done by assigning
the list of elements within square brackets;
 Python
 myList = [“item0”, “item1”, “item2”, “item3”]
 This example is a list of four elements that are string data
types.

 An arrays & lists can be thought of a number of separate
storage locations arranged pattern.
 Arrays & lists are used to store multiple data items of the
same type.

DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION
 Structured Data Types;
 Array Vs List
 Arrays & lists have many similar features however;
 Array will be set to a maximum size from first
initialisation,
 Lists are dynamic and their size is mutable
(changeable)


 In most languages arrays are easier to setup and use
prior to learning the use of dynamic memory,
However Python does all of this for you,
so we jump into the use of lists over arrays as they are quite
similar but have that distinct advantage over arrays.

DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION
 Structured Data Types;
 Records (Struct/class type)
 A record consists of a number of data items, called
fields which maybe logically linked.
 An array of records gives a programmer the
opportunity to create large databases with a
structure that is easily represented on paper.
 A record is a custom made data type by the
programmer, and consists of a variety of simple or
even structured data types.
DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION

DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION
 Structured Data Types;
 Files
 A file is normally categorised as the source which
has collection of data held in different forms.
 These files they have records and moreover they
have fields.
 The logical relationship between files in a database
management system allow users to create program
linking files using one or fields.
 These are the report generators that are linked
through different fields and records.
DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION
 Characters Represented as Numbers
 ASCII
 American Standard Code for Information Interchange
 Character-encoding scheme originally based on the English
alphabet that encodes 128 specified characters;
 Numbers 0-9,
 Letters a-z and A-Z,
 Basic punctuation symbols,
 Some control codes that originated with Teletype
machines,
 Blank space
 into the 7-bit binary integers.
 ASCII codes represent text in computers, communications
equipment, and other devices that use text.

DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION
 Characters Represented as Numbers
 ASCII
 Most modern character-encoding schemes are based on
ASCII, though they support many additional characters.
 ASCII its self is an outdated model,
 Character encoding methods used in modern day
include;
 MS Windows-1252
 Other types of Extended ASCII.

DATA TYPES – REPRESENTATION OF
DATA & INSTRUCTION
 Characters Represented as Numbers
 ASCII
 Encode your full name in;
 Binary, Octal, Decimal, and Hexadecimal.
 Using manual methods discussed previously!
 Given that the
 Binary Value for “A” is 0100 0001 (65 Dec)
 Binary Value for “B” is 0100 0010 (66
Dec)
 Binary value for “a” is 0110 0001 (97 Dec)
 Binary value for “ “ is 0010 0000 (32 Dec)
STRUCTURED ALGORITHMS
8.2.1
Defining and understanding the problem,
Planning and designing software solutions
STRUCTURED ALGORITHMS
 Algorithm
 An algorithm is the common way of performing
certain task.
 It involves step by step procedures of solving problem
that requires certain number of steps and could
require some repetition of those procedures.
 It helps in determining the design of the solution by
breaking down the problem into manageable steps.
 Algorithm is widely used in activities of our daily life's
such as when driving, cooking with recipes, building,
paying fees etc
 All the activities stated above has the definite solution
and the procedure in performing those task
STRUCTURED ALGORITHMS
 Algorithm
 For algorithm to work in all situations, the steps must be
written and programmed in a particular sequence or order.
 It is really important that the problem is fully understood.
 When Algorithm has developed it should be tested and
checked against the desired output and if it requires it
should modified or discarded and a new algorithm written.
 It is believed that there is more then one algorithm for a
problem.
 All algorithm should have a start and a single ending.
 It should have input and output structure for data which is
desired to be achieved through the process of finite steps.
STRUCTURED ALGORITHMS
 Algorithm
 There are various ways of representing algorithm
description.
 Flowcharts
 Pseudocode

STRUCTURED ALGORITHMS
 Flow Charts
 Flowcharts are favoured as a
method of algorithm description,
it is easier to follow the structure
in a pictorial or graphical
method.
 In a flow chart you can write
steps you need in diagram form,
as a seise of steps connected by
arrows, which makes it easier to
understand.
 When reading flowcharts we
read the flow of structure from
top to bottom or left to right
moving step by step across along
the flow lines.
Symbol Purpose
Terminal;
BEGIN/END
Process,
assignment or
operation.
Subroutine or
subprogram (user
defined or
predefined)
Decision (IF
statement)
Input/Output
Data and
program flow
structure
STRUCTURED ALGORITHMS
 Flow Charts
 Crash Bandicoot was a game first
released in 1996 on the Sony
PlayStation. In this game the
player would collect wampa fruit
as they played once 100 wampa
fruits where collected the number
of players lives would increase by
one and the wampa total would
be resent to zero.
 Use a flow chart to represent the
process of determining when a
new life is earned added and
wampa fruits are managed.
Symbol Purpose
Terminal;
BEGIN/END
Process,
assignment or
operation.
Subroutine or
subprogram (user
defined or
predefined)
Decision (IF
statement)
Input/Output
Data and
program flow
structure
STRUCTURED ALGORITHMS
 Pseudocode
 Pseudocode is a very popular method of writing algorithm description.
 It is easily written and modified using word process.
 The keywords are highlighted in Capital letters or bold type to emphasis them and
to indicate the type of action being performed
 Pseudocode allows us to focus on the logical detail of the problem solution without
getting hung-up on the syntax rules of a particular programming language.
 This system of writing algorithm do not have uniform method of writing.
 It is written differently by different writers.
 If the Pseudocode is used, it should be written in such a way that any language
programmer should able to use it to write programs.

 NOTE::
This is how you will write all programming components in an exam
including your HSC!
 You will only start to shy away from this method in examination once you reach
University, However you will still be expected to use it in your reporting for assignments
and major project documentation.
STRUCTURED ALGORITHMS
 Pseudocode
 The flow control in Pseudocode is always from top
to down.
 The keywords are grouped in pairs for example;
 For every BEGIN there is an END
 For every IF there is an ENDIF
STRUCTURED ALGORITHMS
 Pseudocode
 Convert the flowchart you have created for Crash
Bandicoot into pseudocode.
 Remember we start with one
BEGIN and finish with one END
 All key words are capitalised
and paired (have a termination).
STRUCTURED ALGORITHMS
 Control Structures
 Structured programming is a method of breaking
a program into logical sections.
 Algorithms are composed of standard constructs
or control structures, which are the building blocks
of an algorithm
 In developing a structured program, a
programmer uses a method of algorithm
description using three basic structures.
STRUCTURED ALGORITHMS
 Control Structures
 Sequence
 Selection
 Repetition
STRUCTURED ALGORITHMS
 Control Structures
 Sequence
 Is the order in which the steps are executed.
 in Pseudocode and flowchart the steps are placed
between BEGIN and END.
STRUCTURED ALGORITHMS
 Control Structures
 Selection
 Is the feature of computer to make logical decisions, that
determines which particular step to be executed out of
many steps
 Using selection, a condition such as a question is given.
 Then depending on the answer, different paths are followed.
 The key words are IF…THEN..ELSE are used for binary selection,
whereas the condition after the IF keyword.
 There are two possible solution for the IF either true or false
 When the IF condition applies then program should execute the
THEN keyword.
 When the IF is false the program will skip to the next step ignoring
the THEN condition and finishes the binary selection with the
ENDIF

STRUCTURED ALGORITHMS
 Control Structures
 Repetition
 This loop structure that allows the steps to be
repeated until the some condition is satisfied.
 Also known as Iteration.
 In a repetition control structure its very important
that each loop contains a condition to stop and
going forever.
 Its important to test the condition at the beginning
and/or end.
STRUCTURED ALGORITHMS
 Control Structures
 Repetition
 Pre-test repetition
 This is also referred to as guarded loop, which is tested at a very
beginning.
 Keywords used in pseudocode are WHILE…ENDWHILE.
 The condition is stated after WHILE key and the loop is in
between WHILE AND ENDWHILE key.
 Post-test repetition
 This is also referred to as unguarded loop, which is tested at a
end of the loop after the steps to be repeated are executed.
 Keywords used in pseudocode are REPEAT..UNTIL.
 The body of the loop to be executed is placed underneath
REPEAT and the post-test repetition the condition is after UNTIL.
STRUCTURED ALGORITHMS
 Control Structures
 Repetition
 Pre-test repetition
 Consider the example below
Pseudocode;
 BEGIN
 WHILE travelling on the train
 buy ticket
 END WHILE
 END
STRUCTURED ALGORITHMS
 Control Structures
 Repetition
 Post-test repetition
 Consider the example below
Pseudocode ;
 BEGIN
 REPEAT
 wear black shoes to school
 UNTIL it’s a sports day
 END
STRUCTURED ALGORITHMS
 Control Structures
 Repetition
 Countered loop
 Programs often needs to execute a set of steps a
predetermined number of times.
 In this case, a counted loop using the construction:
 For identifier goes from value_1 to value_2… Next
identifier
 This is also known as definite loop.
 When programming it‟s important to initialise the
loop control variable.
STRUCTURED ALGORITHMS
 Control Structures
 Repetition
 Countered loop
 Consider an algorithm to display numbers 1 through 20;
Pseudocode;

 BEGIN
 set end to 20
 Set counter to 1
 WHILE counter is less than or equal to
 print counter
 increment counter by one
 ENDWHILE
 END

STRUCTURED ALGORITHMS
 Checking Algorithms
 Its crucial to check the algorithm description steps
ability to solve the problem.
 This process of checking is known as desk
checking
 This involves the process of checking the following:
 Values of the variables
 Outputs of the algorithm
STRUCTURED ALGORITHMS
 Checking Algorithms; Desk Checking
 The process of checking is done using the sample
data and this data items are classified as test
data.
 While checking its important to keep recording
progress.

STRUCTURED ALGORITHMS
 Desk Checking Algorithms
STRUCTURED ALGORITHMS
DESK CHECKING ALGORITHMS;

 Pseudo-code: Pythagoras Theorem.
BEGIN
PRINT “Length of side A”
SET sideA TO USER_INPUT
PRINT “Length of side B”
SET sideB TO USER_INPUT
SET sqSideC TO sideA*sideA + sideB*sideB
SET sideC to square root of sqSideC
PRINT “Length of Side C is” AND sideC
END
Line SideA SideB sqSideC sideC Input Output
1 Length of side A
2 3 3
3 3 Length of side B
4 3 4 4
5 3 4 25
6 3 4 25 5
7 3 4 25 5 Length of Side C is 5
STRUCTURED ALGORITHMS
 Desk Checking Algorithms;
 Desk check the algorithm you created for Crash Bandicoot.
 Design a algorithm, using flowcharts and pseudocode that takes each of the
student, one at a time and determines their final grade.
 Given that
 Exam one was out of 50 marks
 Assignment One was out of 60 marks
 Assignment two was out of 60 marks and
 Final Exam was out of 100 marks
 Once you have designed your algorithm, desk check it to ensure it is
functional.
 Once your algorithm has been checked and is perfect, you may code it.
STRUCTURED
ALGORITHMS
 For this program;
 Write the purpose,
 Write the expectations of the final program,
 i.e that it calculates each mark correctly and weights them appropriately with no error in
final grades.
 Draw an IPO Chart and table for the proposed program.
 Create a data dictionary for the proposed program.
 Use a hierarchical diagram to illustrate the structure and proposed
development approach to developing the program.
 Define each function (subroutine of the program).
 Draw a flowchart of the main program and each subroutine of the program.
 Translate the flowchart into pseudo-code
 Desk check the algorithm written in pseudo-code.
 Implement you algorithm using Python.
 Test your code
 Evaluate your program against the initial purpose and expectations.

END!

8.2.1
DEFINING AND UNDERSTANDING THE
PROBLEM,
PLANNING AND DESIGNING
SOFTWARE SOLUTIONS

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.