0% found this document useful (0 votes)
2 views5 pages

Program Design

The document explains structure charts, a modeling tool used in program design to break down problems into manageable sub-tasks represented as modules. It details key features such as top-down design, decomposition, and control flow, and provides an example of a login program with pseudocode. The document emphasizes the focus on what the program does rather than how it does it.

Uploaded by

Simple Skeleton
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Program Design

The document explains structure charts, a modeling tool used in program design to break down problems into manageable sub-tasks represented as modules. It details key features such as top-down design, decomposition, and control flow, and provides an example of a login program with pseudocode. The document emphasizes the focus on what the program does rather than how it does it.

Uploaded by

Simple Skeleton
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Cambridge (CIE) AS Your notes

Computer Science
Program Design
Contents
Structure charts

© 2025 Save My Exams, Ltd. Get more and ace your exams at [Link] 1
Structure charts
Your notes

Structure charts
What is a structure chart?
A structure chart is a modelling tool used in the design stage of program development
It helps to decompose a problem into smaller, manageable sub-tasks, representing
each as a module
Structure charts focus on what the program does, not how it does it

Example
A program that asks a user to enter their username and password
Checks if the password matches the stored password and uses a counter to track how
many times it is checked
If the password matches, a successful message is displayed, else after three failed
attempts a 'denied' message is displayed
A structure chart might look like:

© 2025 Save My Exams, Ltd. Get more and ace your exams at [Link] 2
Your notes

Key features
Feature Explanation

Top-down design The chart starts with the main program and breaks it into sub-
modules

Decomposition Each module represents a specific task or function

Module boxes Each module is shown as a box

Vertical lines Show control flow – which module calls which

Parameter arrows Arrows pointing into modules show data being passed in or
returned

© 2025 Save My Exams, Ltd. Get more and ace your exams at [Link] 3
Stepwise Each level adds more detail to the task above
refinement
Your notes
Diamond shape Shows a condition that could be true or false

Semi-circular arrow Indicates repetition

Pseudocode from structure chart


The first step is to create an identifier table

Identifier Data type Description

Username STRING Stores the username entered by the user

Password STRING Stores the password entered by the user

StoredPass STRING The correct password stored in the system for comparison

NoAttempts INTEGER Counts the number of failed login attempts

LoginSuccess BOOLEAN Indicates whether the login was successful

Next, identify is any functions or procedures could be used

Module Type Purpose

GetCredentials PROCEDURE Asks the user to input username and password

CheckPassword FUNCTION Compares input password with stored password and


returns TRUE/FALSE

ShowAccessMessage PROCEDURE Displays success or failure message

Any finally, write the pseudocode


DECLARE Username : STRING
DECLARE Password : STRING
DECLARE StoredPass : STRING
DECLARE NoAttempts : INTEGER
DECLARE LoginSuccess : BOOLEAN

StoredPass ← "admin123"
NoAttempts ← 0
LoginSuccess ← FALSE

© 2025 Save My Exams, Ltd. Get more and ace your exams at [Link] 4
PROCEDURE GetCredentials()
OUTPUT "Enter username: "
INPUT Username Your notes
OUTPUT "Enter password: "
INPUT Password
ENDPROCEDURE

FUNCTION CheckPassword(P : STRING) RETURNS BOOLEAN


IF P = StoredPass THEN
RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ENDFUNCTION

PROCEDURE ShowAccessMessage(Success : BOOLEAN)


IF Success = TRUE THEN
OUTPUT "Login successful"
ELSE
OUTPUT "Access denied"
ENDIF
ENDPROCEDURE

WHILE NoAttempts < 3 AND LoginSuccess = FALSE


CALL GetCredentials()
LoginSuccess ← CheckPassword(Password)

IF LoginSuccess = FALSE THEN


OUTPUT "Incorrect password"
NoAttempts ← NoAttempts + 1
ENDIF
ENDWHILE

CALL ShowAccessMessage(LoginSuccess)

© 2025 Save My Exams, Ltd. Get more and ace your exams at [Link] 5

You might also like