SlideShare a Scribd company logo
1 of 37
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Problem Solving and Design
Chapter: 09
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Learning Objectives
In this topic we will
learn about:
• computer systems
and sub-systems
• top-down design
• structure
diagrams
• flowcharts
• pseudocode
• library routines
• sub-routines
• algorithms
• standard methods
of solution
• test data
• validation and
verification
• using trace tables
• identifying and
correcting errors
• producing
algorithms
• the effectiveness
of a solution.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Introduction
• In order to build a computer system that performs a
specific task or solves a given problem, the task or
problem has to be clearly defined, showing what is
going to be computed and how it is going to be
computed.
• This topic introduces the tools and techniques that
are used to design a software solution that together
with the associated computer hardware will form a
computer system.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is a computer system?
• A computer system consists of software, data, hardware,
communications and people that have been carefully chosen so
that they work well together in order to build a computer system
that performs a specific task.
• HOT
• Do we have a system other than computer systems?
• Why we use system?
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What tools and techniques are used to
develop a system?
• Computer system is often divided up into sub-systems.
1. This division can be shown using top-down design to produce
structure diagrams that demonstrate the modular construction
of the system.
2. Each sub-system can be developed by a programmer as sub-
routine or an existing library routine may be already available
for use.
3. How each sub-routine works can be shown by using flowcharts or
pseudocode.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Top-down design
• It is the breaking down of a computer system into a set of
subsystems, then breaking each sub-system down into a set of
smaller sub-systems, until each sub-system just performs a single
action.
• This is an effective way of designing a computer system to provide
a solution to a problem, since each part of the problem is broken
down into smaller more manageable problems.
• The process of breaking down into smaller sub-systems is called
‘Stepwise Refinement’.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Structure diagrams
• The STRUCTURE DIAGRAM shows the design of a
computer system in a hierarchical way, with each level
giving a more detailed breakdown of the system into sub-
systems.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Real-life application
• Alarm app for a smart phone
• Consider the alarm app computer system for a smart phone.
• Creating the solution This involves:
1. top-down design or stepwise refinement
2. algorithms, which can be represented as
a. program flowcharts
b. pseudocode
• Using top-down design approach, this could be divided into three sub-systems,
• setting the alarm,
• checking for the alarm time,
• sounding the alarm.
• These sub-systems could then be further sub-divided; the structure diagram
makes the process clearer.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Real-life application
• Structure diagram for alarm app
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Activity
1. A school wants to calculate the number of hours spent in school
by a sample of students from time of arrival and departure data.
Draw a structure diagram and a program flowchart for an
algorithm with the following features:
2. Draw a structure diagram for cleaning your teeth.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Solution
• Calculating hours spent in
school
• Using top-down design approach,
this system could be divided into
three sub-systems,
• For each student, enter the
student’s name, the time of arrival
and the time of departure.
• Calculate the length of time each
student spends in school.
• Output the student’s name and the
time spent in school.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Flowcharts?
• A flowchart is a type of diagram that represents an algorithm,
workflow or process, showing the steps as boxes of various kinds,
and their order by connecting them with arrows. This
diagrammatic representation illustrates a solution model to a
given problem. OR
• A FLOWCHART shows diagrammatically the steps required for a
task (sub-system) and the order that they are to be performed.
These steps together with the order are called an ALGORITHM.
• Flowcharts are an effective way to communicate the algorithm
that shows how a system or sub-system works.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What are flowcharts symbols and their use?
Example
Sir Z@h!d Al!
+971-568047507
+92-3242415561
HOTS - Pair Activity
• Write a flowchart program which input two numbers and output
the sum of these number
• Write a flowchart program to input physics and English marks and
output the total marks
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Critical Thinking - Pair Work
1. Write an algorithm in the form of a flowchart which takes
temperatures input over a 100 day period (once per day) and
outputs the number of days when the temperature was below
20C and the number of days when the temperature was 20C
and above.
2. Write an algorithm in the form of a flowchart which:
• inputs the top speeds (in km/hr) of 5000 cars
• outputs the fastest speed and the slowest speed
• outputs the average (mean) speed of all the 5000 cars
Sir Z@h!d Al!
+971-568047507
+92-3242415561
• Algorithm in the form of a flowchart
Critical Thinking - Pair Work
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is an algorithm?
• An algorithm is a self-contained sequence of
actions to be performed to solve a problem.
• Well-structured programs require a programming
language to support the following program
constructs:
• sequence
• selection
• iteration
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is pseudocode?
• Pseudocode is an informal high-level description
of the operating principle of a computer program
or other algorithm. It uses the structural
conventions of a normal programming language,
but is intended for human reading rather than
machine reading.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Understand and use pseudocode
• understand and use pseudocode for assignment, using ←
• understand and use pseudocode, using the following
commands and statements:
• INPUT and OUTPUT (e.g. READ and PRINT)
• totaling (e.g. Sum ← Sum + Number)
• counting (e.g. Count ← Count + 1)
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Understand and use pseudocode / algorithm
• understand and use pseudocode, using the following conditional
statements:
• IF … THEN … ELSE … ENDIF
• CASE … OF … OTHERWISE … ENDCASE
• understand and use pseudocode, using the following loop
structures:
• FOR … TO … NEXT
• REPEAT … UNTIL
• WHILE … DO … ENDWHILE
• (Candidates are advised to try out solutions to a variety of different
problems on a computer using a language of their choice; no
particular programming language will be assumed in this syllabus.)
Sir Z@h!d Al!
+971-568047507
+92-3242415561
HOTS - Algorithm Vs Pseudocode Vs Program
• An algorithm is a well-defined procedure that allows a
computer to solve a problem.
• Pseudocode is a simple way of writing programming
code in simple language like English.
• A program is a sequence of instructions in a particular
programming language for instance QBASIC or C++,
written to perform a specified task on a computer.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
HOTS - Pair Activity
•Write a algorithm program which input
two numbers and output the sum of
these number
•Write a algorithm program to input
physics and English marks and output
the total marks
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Critical Thinking - Pair Work
1. Write an algorithm in the form of a pseudocode / flowchart
which takes temperatures input over a 100 day period (once
per day) and outputs the number of days when the
temperature was below 20C and the number of days when the
temperature was 20C and above.
2. Write an algorithm in the form of a pseudocode / flowchart
which:
• inputs the top speeds (in km/hr) of 5000 cars
• outputs the fastest speed and the slowest speed
• outputs the average (mean) speed of all the 5000 cars
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Library routines?
• A LIBRARY ROUTINE is a set of programming
instructions for a given task that is already
available for use.
• It is pre-tested and usually performs a task that is
frequently required.
• For example, the task „get time‟ in the checking-
for-the-alarm time algorithm would probably be
readily available as a library routine.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Sub-routines?
•A SUB-ROUTINE is a set of programming
instructions for a given task that forms a
subsystem, not the whole system.
•Sub-routines written in high-level
programming languages are called
„procedures‟ or „functions‟ depending on
how they are used.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Test Data? Why it is important ?
• Test data is the data that is used in tests of a program or system.
• In order to test a program we need to enter some data for testing
most of the features. Any such specifically identified data which
is used in tests is known as test data.
• There are following three types of test data:
• 1. Normal Data
• 2. Extreme Data
• 3. Abnormal Data
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Difference between Normal, Extreme and
Abnormal Data
Test Case Explanation
Example where a
score should be
between 0 and 50
Normal
Data that you would expect to work
or be accepted and that lies within
the range
2, 45
Extreme
Data at the lower and upper limits of
the range
0, 50
Abnormal
Data that should not be accepted by
the program
-7, 51, Ahmed
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Rogue Values?
• A value of input which is used to halt / break to
repetitive statement. OR
• A sequence of inputs may continue until a
specific value is arrived / input. This value is
called a rogue value and must be a value which
would not normally arise.
• A rogue value lets the computer know that a
sequence of input values has come to an end.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Pair Work Activity
• A number of marks are to be input (terminated by a rogue value of
-1). How many of them are over 50?
• Counter = 0
• INPUT Marks
• REPEAT
• IF Marks >50 THEN counter = counter +1
• INPUT Marks
• UNTIL Marks=-1
• OUTPUT counter
Sir Z@h!d Al!
+971-568047507
+92-3242415561
How readable is your code?
• Often programmers will work on each other's code. So you need to
write your code so that it can be read and understood by others.
You also need to be able to understand it if you come back to it
months or years later. There are a few techniques you can use to
help with this:
• Internal commentary
• Meaningful identifiers (variable names)
• Indentation
• White Space
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What kind of test data would be used to find out if
a program works under regular circumstances?
a) Normal
b) Extreme
c) Exceptional
Sir Z@h!d Al!
+971-568047507
+92-3242415561
How to make sure that there is no error in
the data?
• Data verification and data validation are two
methods of making sure no errors occur in the
data before processing takes place. (Make sure
you know the difference between them!)
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Data Verification?
• Typing data into a computer from a data capture form is called
transcribing. If an error is made it is a transcription error.
• Verification is done to eliminate transcription errors.
• Methods of verification...
Proof
reading
A visual check by eye that no errors have been made. This is
sometimes done by printing out data that has been input, and
sending it back to the source of the data to check. For example,
printed proofs of the pages of a book may be sent back to the author
for checking.
Double-
keying
This is a check to see if data has been keyed in correctly. The data is
keyed in twice, and the computer will only accept the data for
processing if the two versions are identical.
Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Validation?
• Validation is the automated checking by a program
that data is reasonable before it is accepted into a
computer system. Different types of check may be
used on the same piece of data;
• A check to see if data is 'valid' before it is processed
that it is sensible data.
• There are a number of different data validation
checks which can be carried out. Following are some
of them:
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Types of Validations
Validation type How it works Example usage
Check digit the last one or two digits in a code are
used to check the other digits are
correct
bar code readers in supermarkets use check
digits
Format check checks the data is in the right format a National Insurance number is in the form LL
99 99 99 L where L is any letter and 9 is any
number
Length check checks the data isn't too short or too
long
a password which needs to be eight letters
long
Lookup table looks up acceptable values in a table there are only seven possible days of the week
Presence check checks that data has been entered into
a field
in most databases a key fieldcannot be left
blank
Range check checks that a value falls within the
specified range
number of hours worked must be less than 50
and more than 0
Spell check looks up words in a dictionary when word processing
Sir Z@h!d Al!
+971-568047507
+92-3242415561
Challenge!!! Individual work
• Write an pseudocode for range check.
• Draw the flow chart for the range check.
• Write an pseudocode for presence check.
• Draw the flow chart for the presence check.
• Write an pseudocode for length check.
• Draw the flow chart for the length check.
• Try same for other varification and validation checks like double
keying etc.

More Related Content

What's hot

Compiler Optimization Presentation
Compiler Optimization PresentationCompiler Optimization Presentation
Compiler Optimization Presentation19magnet
 
Code generator
Code generatorCode generator
Code generatorTech_MX
 
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Mohammad Ilyas Malik
 
CPU Scheduling Algorithm (SJF, Round-Robin, Priority)
CPU Scheduling Algorithm (SJF, Round-Robin, Priority)CPU Scheduling Algorithm (SJF, Round-Robin, Priority)
CPU Scheduling Algorithm (SJF, Round-Robin, Priority)Solaiman Hridoy
 
Longest increasing subsequence
Longest increasing subsequenceLongest increasing subsequence
Longest increasing subsequenceS.Shayan Daneshvar
 
Goals of protection
Goals of protectionGoals of protection
Goals of protectionveena ali
 
Session tracking in servlets
Session tracking in servletsSession tracking in servlets
Session tracking in servletsvishal choudhary
 
Principal Sources of Optimization in compiler design
Principal Sources of Optimization in compiler design Principal Sources of Optimization in compiler design
Principal Sources of Optimization in compiler design LogsAk
 
Algorithm Designs - Control Structures
Algorithm Designs - Control StructuresAlgorithm Designs - Control Structures
Algorithm Designs - Control Structureshatredai
 
Chapter 5 Database Transaction Management
Chapter 5 Database Transaction ManagementChapter 5 Database Transaction Management
Chapter 5 Database Transaction ManagementEddyzulham Mahluzydde
 

What's hot (20)

Compiler Optimization Presentation
Compiler Optimization PresentationCompiler Optimization Presentation
Compiler Optimization Presentation
 
Code generator
Code generatorCode generator
Code generator
 
Object oriented analysis and design unit- iii
Object oriented analysis and design unit- iiiObject oriented analysis and design unit- iii
Object oriented analysis and design unit- iii
 
Path Testing
Path TestingPath Testing
Path Testing
 
Java – lexical issues
Java – lexical issuesJava – lexical issues
Java – lexical issues
 
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
 
CPU Scheduling Algorithm (SJF, Round-Robin, Priority)
CPU Scheduling Algorithm (SJF, Round-Robin, Priority)CPU Scheduling Algorithm (SJF, Round-Robin, Priority)
CPU Scheduling Algorithm (SJF, Round-Robin, Priority)
 
The Art of Debugging.pptx
The Art of Debugging.pptxThe Art of Debugging.pptx
The Art of Debugging.pptx
 
Longest increasing subsequence
Longest increasing subsequenceLongest increasing subsequence
Longest increasing subsequence
 
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
 
Goals of protection
Goals of protectionGoals of protection
Goals of protection
 
Session tracking in servlets
Session tracking in servletsSession tracking in servlets
Session tracking in servlets
 
P code
P codeP code
P code
 
Architecture of MessagePack
Architecture of MessagePackArchitecture of MessagePack
Architecture of MessagePack
 
Principal Sources of Optimization in compiler design
Principal Sources of Optimization in compiler design Principal Sources of Optimization in compiler design
Principal Sources of Optimization in compiler design
 
Algorithm Designs - Control Structures
Algorithm Designs - Control StructuresAlgorithm Designs - Control Structures
Algorithm Designs - Control Structures
 
Chapter 5 Database Transaction Management
Chapter 5 Database Transaction ManagementChapter 5 Database Transaction Management
Chapter 5 Database Transaction Management
 
Role-of-lexical-analysis
Role-of-lexical-analysisRole-of-lexical-analysis
Role-of-lexical-analysis
 
First and follow set
First and follow setFirst and follow set
First and follow set
 
Introduction to package in java
Introduction to package in javaIntroduction to package in java
Introduction to package in java
 

Similar to Problem solving and design

Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptxTadiwaMawere
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programmingSangheethaa Sukumaran
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem slovingMani Kandan
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing TechniquesAppili Vamsi Krishna
 
Algorithm and C code related to data structure
Algorithm and C code related to data structureAlgorithm and C code related to data structure
Algorithm and C code related to data structureSelf-Employed
 
Pseudo code.pptx
Pseudo code.pptxPseudo code.pptx
Pseudo code.pptxChaya64047
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Dr. Pankaj Agarwal
 
01 introduction to cpp
01   introduction to cpp01   introduction to cpp
01 introduction to cppManzoor ALam
 
Cse115 lecture03problemsolving
Cse115 lecture03problemsolvingCse115 lecture03problemsolving
Cse115 lecture03problemsolvingMd. Ashikur Rahman
 
Pj01 1-computer and programming fundamentals
Pj01 1-computer and programming fundamentalsPj01 1-computer and programming fundamentals
Pj01 1-computer and programming fundamentalsSasidharaRaoMarrapu
 
FPL -Part 2 ( Sem - I 2013)
FPL -Part 2 ( Sem - I 2013)FPL -Part 2 ( Sem - I 2013)
FPL -Part 2 ( Sem - I 2013)Yogesh Deshpande
 
C++ programming program design including data structures
C++ programming program design including data structures C++ programming program design including data structures
C++ programming program design including data structures Ahmad Idrees
 

Similar to Problem solving and design (20)

Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptx
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
L1
L1L1
L1
 
Algorithm.pdf
Algorithm.pdfAlgorithm.pdf
Algorithm.pdf
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem sloving
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing Techniques
 
Lecture1
Lecture1Lecture1
Lecture1
 
Algorithm and C code related to data structure
Algorithm and C code related to data structureAlgorithm and C code related to data structure
Algorithm and C code related to data structure
 
Pseudo code.pptx
Pseudo code.pptxPseudo code.pptx
Pseudo code.pptx
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis
 
01 introduction to cpp
01   introduction to cpp01   introduction to cpp
01 introduction to cpp
 
Flowcharting week 5 2019 2020
Flowcharting week 5  2019  2020Flowcharting week 5  2019  2020
Flowcharting week 5 2019 2020
 
Introduction to C ++.pptx
Introduction to C ++.pptxIntroduction to C ++.pptx
Introduction to C ++.pptx
 
lect 1-ds algo(final)_2.pdf
lect 1-ds  algo(final)_2.pdflect 1-ds  algo(final)_2.pdf
lect 1-ds algo(final)_2.pdf
 
Cse115 lecture03problemsolving
Cse115 lecture03problemsolvingCse115 lecture03problemsolving
Cse115 lecture03problemsolving
 
Cse
CseCse
Cse
 
Pj01 1-computer and programming fundamentals
Pj01 1-computer and programming fundamentalsPj01 1-computer and programming fundamentals
Pj01 1-computer and programming fundamentals
 
Flow charts week 5 2020 2021
Flow charts week 5 2020  2021Flow charts week 5 2020  2021
Flow charts week 5 2020 2021
 
FPL -Part 2 ( Sem - I 2013)
FPL -Part 2 ( Sem - I 2013)FPL -Part 2 ( Sem - I 2013)
FPL -Part 2 ( Sem - I 2013)
 
C++ programming program design including data structures
C++ programming program design including data structures C++ programming program design including data structures
C++ programming program design including data structures
 

Recently uploaded

ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 

Recently uploaded (20)

ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 

Problem solving and design

  • 2. Sir Z@h!d Al! +971-568047507 +92-3242415561 Learning Objectives In this topic we will learn about: • computer systems and sub-systems • top-down design • structure diagrams • flowcharts • pseudocode • library routines • sub-routines • algorithms • standard methods of solution • test data • validation and verification • using trace tables • identifying and correcting errors • producing algorithms • the effectiveness of a solution.
  • 3. Sir Z@h!d Al! +971-568047507 +92-3242415561 Introduction • In order to build a computer system that performs a specific task or solves a given problem, the task or problem has to be clearly defined, showing what is going to be computed and how it is going to be computed. • This topic introduces the tools and techniques that are used to design a software solution that together with the associated computer hardware will form a computer system.
  • 5. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is a computer system? • A computer system consists of software, data, hardware, communications and people that have been carefully chosen so that they work well together in order to build a computer system that performs a specific task. • HOT • Do we have a system other than computer systems? • Why we use system?
  • 6. Sir Z@h!d Al! +971-568047507 +92-3242415561 What tools and techniques are used to develop a system? • Computer system is often divided up into sub-systems. 1. This division can be shown using top-down design to produce structure diagrams that demonstrate the modular construction of the system. 2. Each sub-system can be developed by a programmer as sub- routine or an existing library routine may be already available for use. 3. How each sub-routine works can be shown by using flowcharts or pseudocode.
  • 7. Sir Z@h!d Al! +971-568047507 +92-3242415561 Top-down design • It is the breaking down of a computer system into a set of subsystems, then breaking each sub-system down into a set of smaller sub-systems, until each sub-system just performs a single action. • This is an effective way of designing a computer system to provide a solution to a problem, since each part of the problem is broken down into smaller more manageable problems. • The process of breaking down into smaller sub-systems is called ‘Stepwise Refinement’.
  • 8. Sir Z@h!d Al! +971-568047507 +92-3242415561 Structure diagrams • The STRUCTURE DIAGRAM shows the design of a computer system in a hierarchical way, with each level giving a more detailed breakdown of the system into sub- systems.
  • 9. Sir Z@h!d Al! +971-568047507 +92-3242415561 Real-life application • Alarm app for a smart phone • Consider the alarm app computer system for a smart phone. • Creating the solution This involves: 1. top-down design or stepwise refinement 2. algorithms, which can be represented as a. program flowcharts b. pseudocode • Using top-down design approach, this could be divided into three sub-systems, • setting the alarm, • checking for the alarm time, • sounding the alarm. • These sub-systems could then be further sub-divided; the structure diagram makes the process clearer.
  • 10. Sir Z@h!d Al! +971-568047507 +92-3242415561 Real-life application • Structure diagram for alarm app
  • 11. Sir Z@h!d Al! +971-568047507 +92-3242415561 Activity 1. A school wants to calculate the number of hours spent in school by a sample of students from time of arrival and departure data. Draw a structure diagram and a program flowchart for an algorithm with the following features: 2. Draw a structure diagram for cleaning your teeth.
  • 12. Sir Z@h!d Al! +971-568047507 +92-3242415561 Solution • Calculating hours spent in school • Using top-down design approach, this system could be divided into three sub-systems, • For each student, enter the student’s name, the time of arrival and the time of departure. • Calculate the length of time each student spends in school. • Output the student’s name and the time spent in school.
  • 13. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Flowcharts? • A flowchart is a type of diagram that represents an algorithm, workflow or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows. This diagrammatic representation illustrates a solution model to a given problem. OR • A FLOWCHART shows diagrammatically the steps required for a task (sub-system) and the order that they are to be performed. These steps together with the order are called an ALGORITHM. • Flowcharts are an effective way to communicate the algorithm that shows how a system or sub-system works.
  • 14. Sir Z@h!d Al! +971-568047507 +92-3242415561 What are flowcharts symbols and their use? Example
  • 15. Sir Z@h!d Al! +971-568047507 +92-3242415561 HOTS - Pair Activity • Write a flowchart program which input two numbers and output the sum of these number • Write a flowchart program to input physics and English marks and output the total marks
  • 16. Sir Z@h!d Al! +971-568047507 +92-3242415561 Critical Thinking - Pair Work 1. Write an algorithm in the form of a flowchart which takes temperatures input over a 100 day period (once per day) and outputs the number of days when the temperature was below 20C and the number of days when the temperature was 20C and above. 2. Write an algorithm in the form of a flowchart which: • inputs the top speeds (in km/hr) of 5000 cars • outputs the fastest speed and the slowest speed • outputs the average (mean) speed of all the 5000 cars
  • 17. Sir Z@h!d Al! +971-568047507 +92-3242415561 • Algorithm in the form of a flowchart Critical Thinking - Pair Work
  • 18. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is an algorithm? • An algorithm is a self-contained sequence of actions to be performed to solve a problem. • Well-structured programs require a programming language to support the following program constructs: • sequence • selection • iteration
  • 19. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is pseudocode? • Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a normal programming language, but is intended for human reading rather than machine reading.
  • 20. Sir Z@h!d Al! +971-568047507 +92-3242415561 Understand and use pseudocode • understand and use pseudocode for assignment, using ← • understand and use pseudocode, using the following commands and statements: • INPUT and OUTPUT (e.g. READ and PRINT) • totaling (e.g. Sum ← Sum + Number) • counting (e.g. Count ← Count + 1)
  • 21. Sir Z@h!d Al! +971-568047507 +92-3242415561 Understand and use pseudocode / algorithm • understand and use pseudocode, using the following conditional statements: • IF … THEN … ELSE … ENDIF • CASE … OF … OTHERWISE … ENDCASE • understand and use pseudocode, using the following loop structures: • FOR … TO … NEXT • REPEAT … UNTIL • WHILE … DO … ENDWHILE • (Candidates are advised to try out solutions to a variety of different problems on a computer using a language of their choice; no particular programming language will be assumed in this syllabus.)
  • 22. Sir Z@h!d Al! +971-568047507 +92-3242415561 HOTS - Algorithm Vs Pseudocode Vs Program • An algorithm is a well-defined procedure that allows a computer to solve a problem. • Pseudocode is a simple way of writing programming code in simple language like English. • A program is a sequence of instructions in a particular programming language for instance QBASIC or C++, written to perform a specified task on a computer.
  • 23. Sir Z@h!d Al! +971-568047507 +92-3242415561 HOTS - Pair Activity •Write a algorithm program which input two numbers and output the sum of these number •Write a algorithm program to input physics and English marks and output the total marks
  • 24. Sir Z@h!d Al! +971-568047507 +92-3242415561 Critical Thinking - Pair Work 1. Write an algorithm in the form of a pseudocode / flowchart which takes temperatures input over a 100 day period (once per day) and outputs the number of days when the temperature was below 20C and the number of days when the temperature was 20C and above. 2. Write an algorithm in the form of a pseudocode / flowchart which: • inputs the top speeds (in km/hr) of 5000 cars • outputs the fastest speed and the slowest speed • outputs the average (mean) speed of all the 5000 cars
  • 25. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Library routines? • A LIBRARY ROUTINE is a set of programming instructions for a given task that is already available for use. • It is pre-tested and usually performs a task that is frequently required. • For example, the task „get time‟ in the checking- for-the-alarm time algorithm would probably be readily available as a library routine.
  • 26. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Sub-routines? •A SUB-ROUTINE is a set of programming instructions for a given task that forms a subsystem, not the whole system. •Sub-routines written in high-level programming languages are called „procedures‟ or „functions‟ depending on how they are used.
  • 27. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Test Data? Why it is important ? • Test data is the data that is used in tests of a program or system. • In order to test a program we need to enter some data for testing most of the features. Any such specifically identified data which is used in tests is known as test data. • There are following three types of test data: • 1. Normal Data • 2. Extreme Data • 3. Abnormal Data
  • 28. Sir Z@h!d Al! +971-568047507 +92-3242415561 Difference between Normal, Extreme and Abnormal Data Test Case Explanation Example where a score should be between 0 and 50 Normal Data that you would expect to work or be accepted and that lies within the range 2, 45 Extreme Data at the lower and upper limits of the range 0, 50 Abnormal Data that should not be accepted by the program -7, 51, Ahmed
  • 29. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Rogue Values? • A value of input which is used to halt / break to repetitive statement. OR • A sequence of inputs may continue until a specific value is arrived / input. This value is called a rogue value and must be a value which would not normally arise. • A rogue value lets the computer know that a sequence of input values has come to an end.
  • 30. Sir Z@h!d Al! +971-568047507 +92-3242415561 Pair Work Activity • A number of marks are to be input (terminated by a rogue value of -1). How many of them are over 50? • Counter = 0 • INPUT Marks • REPEAT • IF Marks >50 THEN counter = counter +1 • INPUT Marks • UNTIL Marks=-1 • OUTPUT counter
  • 31. Sir Z@h!d Al! +971-568047507 +92-3242415561 How readable is your code? • Often programmers will work on each other's code. So you need to write your code so that it can be read and understood by others. You also need to be able to understand it if you come back to it months or years later. There are a few techniques you can use to help with this: • Internal commentary • Meaningful identifiers (variable names) • Indentation • White Space
  • 32. Sir Z@h!d Al! +971-568047507 +92-3242415561 What kind of test data would be used to find out if a program works under regular circumstances? a) Normal b) Extreme c) Exceptional
  • 33. Sir Z@h!d Al! +971-568047507 +92-3242415561 How to make sure that there is no error in the data? • Data verification and data validation are two methods of making sure no errors occur in the data before processing takes place. (Make sure you know the difference between them!)
  • 34. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Data Verification? • Typing data into a computer from a data capture form is called transcribing. If an error is made it is a transcription error. • Verification is done to eliminate transcription errors. • Methods of verification... Proof reading A visual check by eye that no errors have been made. This is sometimes done by printing out data that has been input, and sending it back to the source of the data to check. For example, printed proofs of the pages of a book may be sent back to the author for checking. Double- keying This is a check to see if data has been keyed in correctly. The data is keyed in twice, and the computer will only accept the data for processing if the two versions are identical.
  • 35. Sir Z@h!d Al! +971-568047507 +92-3242415561 What is Validation? • Validation is the automated checking by a program that data is reasonable before it is accepted into a computer system. Different types of check may be used on the same piece of data; • A check to see if data is 'valid' before it is processed that it is sensible data. • There are a number of different data validation checks which can be carried out. Following are some of them:
  • 36. Sir Z@h!d Al! +971-568047507 +92-3242415561 Types of Validations Validation type How it works Example usage Check digit the last one or two digits in a code are used to check the other digits are correct bar code readers in supermarkets use check digits Format check checks the data is in the right format a National Insurance number is in the form LL 99 99 99 L where L is any letter and 9 is any number Length check checks the data isn't too short or too long a password which needs to be eight letters long Lookup table looks up acceptable values in a table there are only seven possible days of the week Presence check checks that data has been entered into a field in most databases a key fieldcannot be left blank Range check checks that a value falls within the specified range number of hours worked must be less than 50 and more than 0 Spell check looks up words in a dictionary when word processing
  • 37. Sir Z@h!d Al! +971-568047507 +92-3242415561 Challenge!!! Individual work • Write an pseudocode for range check. • Draw the flow chart for the range check. • Write an pseudocode for presence check. • Draw the flow chart for the presence check. • Write an pseudocode for length check. • Draw the flow chart for the length check. • Try same for other varification and validation checks like double keying etc.