SlideShare a Scribd company logo
1 of 44
SECTION 2
STAGES OF PROGRAM DEVELOPMENT
 PROBLEM DEFINITION
 ANALYSIS
 DESIGN A SOLUTION USING AN ALGORITHM
 WRITE A COMPUTER PROGRAM
 TEST AND DEBUG THE PROGRAM
 DOCUMENT THE PROGRAM
Problem-
Solving
Phase
Implementation
Phase
PROBLEM SOLVING PHASE:
STEP 1: Define the problem
STEP 2: Find the solution to the problem
STEP 3: Evaluate alternative solutions
STEP 4: Represent the most efficient solution as an
algorithm
STEP 5: Test the algorithm for correctness
STAGE 1: DEFINING THE PROBLEM
Stating what the problem is and what the end result should
be.
A problem should be decomposed into 3 key components:
1. INPUT
2. PROCESS
3. OUTPUT
DEFINING THE PROBLEM
INPUT
(What is given)
OUTPUT
(The expected
output)
PROCESS
(Tasks that
must be
performed)
Example:
 Write a program that enters a student name and date
of birth and calculate the child’s age and write the
name and age of the child.
PROBLEM DEFINITION:
 Required to find the age of a child
 DEFINING DIAGRAM
INPUT PROCESS OUTPUT
1. Student Name Calculate the child’s age 1. Student Name
2. Student DOB From the child’s DOB 2. Student Age
Questions
1. Write a program that is required to read three (3)
numbers, calculate and print their total.
2. Give three integers representing the age of three boys
respectively, write a program to find their average and also
determine the age of the oldest boy.
3. Write a program to enter the base and height of a triangle
and find and print the area.
4. Write a program to read the temperature in degrees Celsius
and convert it to degrees Celsius and Fahrenheit.
PROBLEM DEFINITIONS:
1. Required to find the Total of three numbers.
2. Required to find the average age of 3 boys and the
age of the oldest boy.
3. Required to find the Area of a triangle.
4. Required to find the Fahrenheit equivalent of a
temperature in degrees Celsius.
DEFINING DIAGRAM: QUES. 1
INPUT PROCESS OUTPUT
NUM1 GET NUM1, NUM2,
NUM3
TOTAL/SUM
NUM2 CALCULATE TOTAL
USING NUM1,
NUM2,NUM3
NUM3 DISPLAY TOTAL
QUES. 2
INPUT PROCESS OUTPUT
AGE1 1. Read AGE1, AGE2,
AGE3
1.AVERAGE AGE
AGE2 2. CALCULATE
AVERAGE AGE USING
AGE1, AGE2, AGE3.
2. AGE OF OLDEST BOY
AGE 3 3. FIND AGE OF OLDEST
BOY FROM AGE1, AGE2,
AGE3
4. DISPLAY AVERAGE,
AGE OF OLDEST BOY
QUES. 3
INPUT PROCESS OUTPUT
BASE READ BASE, HEIGHT AREA OF TRIANGLE
HEIGHT CALCULATE AREA
USING BASE AND
HEIGHT
DISPLAY AREA
QUES. 4
INPUT PROCESS OUPUT
DEGREES CELCIUS READ DEGREES
CELCIUS
DEGREES FAHRENHEIT
CALCULATE DEGREES
FAHRENHEIT USING
DEGREES CELCIUS
DISPLAY DEGREES
FAHRENHEIT
ALGORITHMS
 An algorithm is a series of steps to be followed to
perform a task.
An algorithm should be:
1. Precise
2. Unambiguous
3. Finite (i.e. terminate after a given number of steps)
4. Instructions must be in Logical order
Questions
1. Identify which of the options gives the steps in correct sequence:
(a) Get on the bus, get dressed for school, get off the bus at school
(b) Get dressed for school, get off the bus at school, get on the bus
(c) Get off the bus at school, get on the bus, get dressed for school
(d) Get dressed for school, get on the bus, get off the bus at school
2. Consider the following algorithms & identify which one accurately gives the area of a square:
(a) Get length and width
Area = length x width
(b) Get side measurement of square
Area = side x side
(c) Get area of square
Area =Area x 2
(d) Get side measurement of square
Area = side x 4
3. Consider the following algorithm and choose the correct
step to make it complete:
Purchase some ice-cream and toppings
Get ice-cream scoop
Use scoop to place two scoops of ice-cream on cone
Cover with sprinkles
Add a cherry to the top
(a) Eat cake
(b) Go to the cinema
(c) Purchase cone
(d) Enjoy the movie
VARIABLES
 A Variable is a location in memory where data of
different types are stored. When you declare a variable
the computer sets aside a location in memory to store
data.
num1 num2 sum
E.g. var num1, num2, sum: integer;
 A variable can be given a value or a variable can be set
to a specific value.
E.g. num1:= 1
Or the user inputs the value for num1 (1, 2, 3, 5, 90, etc.)
 A variable can hold ONLY one value at a time. If a new
value is entered, the old one is lost.
e.g.
5 is currently being stored in the
num1 memory location with the label,
num1 (variable). If you enter a new
value, say 15 for the variable num1,
the value 5 is replaced by the value
num1 15.
5
15
1)Write a program that is required to read three (3)
numbers, calculate and print their total.
2)Write a program to enter girls’ heights. Calculate the
average height of the girls.
• Underline the variables in your program!
3)Identify all the variables in the program AreaOfSquare.
1. Write an algorithm to find the sum of two numbers
and display the sum.
2. Write an algorithm to enter the name of an item, Cost
Price of an item, the number of items purchased;
calculate the Total Cost of items and display the
name of the item and total cost of the items.
3. Write an algorithm to enter a student’s name, three
marks; calculate the average mark. Display the
student’s name and average mark.
Program AreaOfSquare;
var s, a: integer;
Begin
write(‘Enter length of side:’);
read (s); {store length in s}
a:= s*s; {calculate area; store in a}
writeln; {print a blank line}
writeln(‘Area of square is’, a);
End.
VARIABLE NAMES/Identifiers
The variable name can:
• Start with a letter or underscore
• Be a combination of letters, digits and underscore
• The length of the variable name cannot exceed 31
characters
• No spaces are allowed in the variable names
Exercise:
 Identify the valid and invalid variable names:
R
_XYZ
Alpha;beta
Net Pay
Maxamt
Root1
2hottohandle
DATA TYPES
 Integer
 Real (floating point)
 String
 Boolean (data which can be true or false)
 Character (data consisting of a single character)
Examples of data types:
 Integer:- 3, -59, 0, 1987
 Real:- 3.142, -5.0, 1.16
 Boolean:- True or False
 Character- ‘k’, ‘8’
 String:- ‘Hi there’
ALGORITHMIC STRUCTURE
 Header- Algorithm’s name or title
 Declaration- A brief description of algorithm and
variables used.
 Body- sequence of steps
 Terminator- end statement
PSEUDOCODE
 An outline of a program, written in a form that can
easily be converted into real programming statements.
CONTROL STRUCTURES
 SEQUENCE
 SELECTION
 REPETITION (LOOP)
SEQUENTIAL STRUCTURE
 INPUT STATEMENTS. For example,
A. Get num1, num2
B. Read price
• OUTPUT STATEMENTS. For example,
A. Print Total_Cost
B. Display Average
• Statements with arithmetic operations:
A. Sum = num1 + num2
• Statements that assign values to variables:
A. Count = 0
B. Max = 20
SELECTION STRUCTURE
 IF-THEN-ELSE
A. If (A>B) then
Display A
B. If (age>= 50)
Print “Old”
Else
Print “Young”
REPETITION: LOOP
A. While (price <> 0) do
read price
total = total + price
End while
B. Repeat 10 times
Print “I am good looking”
End Repeat
FLOWCHARTS
 Algorithms can also be expressed as flowcharts. A
flowchart is a pictorial representation of an algorithm.
 A parallelogram- represents the input & output operation.
 A rectangle- used to represent processing/assignment
statements.
 A diamond- represents a decision (if-then-else).
 An elliptical shape- represents terminal indicators.
 Directional arrows- indicate the flow of logic in the
program.
INPUT/OUTPUT
PROCESSING/ASSIGNMENT
DECISION
START/STOP
FLOW OF LOGIC
SEQUENCE
DECISION
 FOR LOOP
REPITITION
WHILE LOOP
REPEAT UNTIL
http://users.evtek.fi/~jaanah/IntroC/DBeech/3gl_flow.htm
ARRAYS
 An array is a special variable where we reserve a series
of locations in memory to store data items of a certain
data type. These related data items are of the same
data type.
DECLARING AN ARRAY
 Example:
var MARKS: Array[1..35] of integer;
Reserved
word
Variable
Name
Group of
35 Data type
MARKS is the name of the entire array. In order to access one data item the
subscript is used.
MARKS
1 2 3 4 5
RESOURCES
EXERCISES

More Related Content

What's hot

Control Structures
Control StructuresControl Structures
Control Structures
Ghaffar Khan
 
class and objects
class and objectsclass and objects
class and objects
Payel Guria
 

What's hot (20)

Methods in Java
Methods in JavaMethods in Java
Methods in Java
 
Dijkstra's Algorithm
Dijkstra's Algorithm Dijkstra's Algorithm
Dijkstra's Algorithm
 
Operator precedence
Operator precedenceOperator precedence
Operator precedence
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Control Structures
Control StructuresControl Structures
Control Structures
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Variables, Data Types, Operator & Expression in c in detail
Variables, Data Types, Operator & Expression in c in detailVariables, Data Types, Operator & Expression in c in detail
Variables, Data Types, Operator & Expression in c in detail
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Introduction to algorithms
Introduction to algorithmsIntroduction to algorithms
Introduction to algorithms
 
2. Characteristics of Algorithm.ppt
2. Characteristics of Algorithm.ppt2. Characteristics of Algorithm.ppt
2. Characteristics of Algorithm.ppt
 
CSharp.ppt
CSharp.pptCSharp.ppt
CSharp.ppt
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
 
Control Statements in Java
Control Statements in JavaControl Statements in Java
Control Statements in Java
 
Introduction to c++ ppt
Introduction to c++ pptIntroduction to c++ ppt
Introduction to c++ ppt
 
class and objects
class and objectsclass and objects
class and objects
 
Pseudocode
PseudocodePseudocode
Pseudocode
 
CS8651 Internet Programming - Basics of HTML, HTML5, CSS
CS8651   Internet Programming - Basics of HTML, HTML5, CSSCS8651   Internet Programming - Basics of HTML, HTML5, CSS
CS8651 Internet Programming - Basics of HTML, HTML5, CSS
 
Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical Analysis
 

Viewers also liked

Problem definition and research design workshop
Problem definition and research design workshopProblem definition and research design workshop
Problem definition and research design workshop
António Moniz
 
TEXTILE DESIGN AS PROBLEM SOLVING(presentation)
TEXTILE DESIGN AS PROBLEM SOLVING(presentation)TEXTILE DESIGN AS PROBLEM SOLVING(presentation)
TEXTILE DESIGN AS PROBLEM SOLVING(presentation)
Ebenezer Kofi Howard
 
Problem solving and_critical_thinking_eltecs
Problem solving and_critical_thinking_eltecsProblem solving and_critical_thinking_eltecs
Problem solving and_critical_thinking_eltecs
Jamie Hoang
 
Design Thinking & Lean Product Development •How to Identify a Real Problem Th...
Design Thinking & Lean Product Development •How to Identify a Real Problem Th...Design Thinking & Lean Product Development •How to Identify a Real Problem Th...
Design Thinking & Lean Product Development •How to Identify a Real Problem Th...
PHX Startup Week
 
HISTORY OF ARCHITECTURE EDUCATION: POTENTIALS AND LIMITATIONS FOR A BETTER DE...
HISTORY OF ARCHITECTURE EDUCATION: POTENTIALS AND LIMITATIONS FOR A BETTER DE...HISTORY OF ARCHITECTURE EDUCATION: POTENTIALS AND LIMITATIONS FOR A BETTER DE...
HISTORY OF ARCHITECTURE EDUCATION: POTENTIALS AND LIMITATIONS FOR A BETTER DE...
Iman Gawad
 
Critical Thinking, Problem Solving, Decision Making
Critical Thinking, Problem Solving, Decision MakingCritical Thinking, Problem Solving, Decision Making
Critical Thinking, Problem Solving, Decision Making
guestd388be
 
Design Theory - Lecture 02: Design processes & Problem solving
Design Theory - Lecture 02: Design processes & Problem solvingDesign Theory - Lecture 02: Design processes & Problem solving
Design Theory - Lecture 02: Design processes & Problem solving
Bas Leurs
 
Problem definition /identification in Research
Problem definition /identification in ResearchProblem definition /identification in Research
Problem definition /identification in Research
Shameem Ali
 

Viewers also liked (20)

Insight & Solving Design Problem with Design Sprint Method
Insight & Solving Design Problem with Design Sprint MethodInsight & Solving Design Problem with Design Sprint Method
Insight & Solving Design Problem with Design Sprint Method
 
Problem definition and research design workshop
Problem definition and research design workshopProblem definition and research design workshop
Problem definition and research design workshop
 
Problem Solving Techniques For Evolutionary Design
Problem Solving Techniques For Evolutionary DesignProblem Solving Techniques For Evolutionary Design
Problem Solving Techniques For Evolutionary Design
 
problem definition
problem definitionproblem definition
problem definition
 
Java: Class Design Examples
Java: Class Design ExamplesJava: Class Design Examples
Java: Class Design Examples
 
Experiment (XP) Gameboard: How Great Organizations Rapidly Solve Problems, Le...
Experiment (XP) Gameboard: How Great Organizations Rapidly Solve Problems, Le...Experiment (XP) Gameboard: How Great Organizations Rapidly Solve Problems, Le...
Experiment (XP) Gameboard: How Great Organizations Rapidly Solve Problems, Le...
 
OGDC2013_Game design problem solving_Mr Nguyen Chi Hieu
OGDC2013_Game design problem solving_Mr Nguyen Chi HieuOGDC2013_Game design problem solving_Mr Nguyen Chi Hieu
OGDC2013_Game design problem solving_Mr Nguyen Chi Hieu
 
Empathy Map and Problem Statement for Design Thinking Action Lab
Empathy Map and Problem Statement for Design Thinking Action LabEmpathy Map and Problem Statement for Design Thinking Action Lab
Empathy Map and Problem Statement for Design Thinking Action Lab
 
Design Thinking and Innovation
Design Thinking and InnovationDesign Thinking and Innovation
Design Thinking and Innovation
 
TEXTILE DESIGN AS PROBLEM SOLVING(presentation)
TEXTILE DESIGN AS PROBLEM SOLVING(presentation)TEXTILE DESIGN AS PROBLEM SOLVING(presentation)
TEXTILE DESIGN AS PROBLEM SOLVING(presentation)
 
Problem solving and_critical_thinking_eltecs
Problem solving and_critical_thinking_eltecsProblem solving and_critical_thinking_eltecs
Problem solving and_critical_thinking_eltecs
 
Design Thinking & Lean Product Development •How to Identify a Real Problem Th...
Design Thinking & Lean Product Development •How to Identify a Real Problem Th...Design Thinking & Lean Product Development •How to Identify a Real Problem Th...
Design Thinking & Lean Product Development •How to Identify a Real Problem Th...
 
HISTORY OF ARCHITECTURE EDUCATION: POTENTIALS AND LIMITATIONS FOR A BETTER DE...
HISTORY OF ARCHITECTURE EDUCATION: POTENTIALS AND LIMITATIONS FOR A BETTER DE...HISTORY OF ARCHITECTURE EDUCATION: POTENTIALS AND LIMITATIONS FOR A BETTER DE...
HISTORY OF ARCHITECTURE EDUCATION: POTENTIALS AND LIMITATIONS FOR A BETTER DE...
 
Communication skills Basic
Communication skills BasicCommunication skills Basic
Communication skills Basic
 
Critical Thinking, Problem Solving, Decision Making
Critical Thinking, Problem Solving, Decision MakingCritical Thinking, Problem Solving, Decision Making
Critical Thinking, Problem Solving, Decision Making
 
Thinking Tools for Creative Kids An Introduction
Thinking Tools for Creative Kids An IntroductionThinking Tools for Creative Kids An Introduction
Thinking Tools for Creative Kids An Introduction
 
Design Theory - Lecture 02: Design processes & Problem solving
Design Theory - Lecture 02: Design processes & Problem solvingDesign Theory - Lecture 02: Design processes & Problem solving
Design Theory - Lecture 02: Design processes & Problem solving
 
Problem definition /identification in Research
Problem definition /identification in ResearchProblem definition /identification in Research
Problem definition /identification in Research
 
Learning Design for Problem-Solving
Learning Design for Problem-SolvingLearning Design for Problem-Solving
Learning Design for Problem-Solving
 
Problem solving & decision making at the workplace
Problem solving & decision making at the workplaceProblem solving & decision making at the workplace
Problem solving & decision making at the workplace
 

Similar to Problem solving and design

Chapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docxChapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docx
tiffanyd4
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docx
gerardkortney
 

Similar to Problem solving and design (20)

Logic Development and Algorithm.
Logic Development and Algorithm.Logic Development and Algorithm.
Logic Development and Algorithm.
 
Chapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docxChapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docx
 
Problem solving (C++ Programming)
Problem solving (C++ Programming)Problem solving (C++ Programming)
Problem solving (C++ Programming)
 
Md university cmis 102 week 3 hands
Md university cmis 102 week 3 handsMd university cmis 102 week 3 hands
Md university cmis 102 week 3 hands
 
UNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.pptUNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.ppt
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docx
 
Simple c-programs
Simple c-programsSimple c-programs
Simple c-programs
 
Best c programs
Best c programsBest c programs
Best c programs
 
UNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.pptUNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.ppt
 
UNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.pptUNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.ppt
 
Introduction to Design Algorithm And Analysis.ppt
Introduction to Design Algorithm And Analysis.pptIntroduction to Design Algorithm And Analysis.ppt
Introduction to Design Algorithm And Analysis.ppt
 
C++ for beginners
C++ for beginnersC++ for beginners
C++ for beginners
 
C code examples
C code examplesC code examples
C code examples
 
Problem solving techniques in c language
Problem solving techniques in c languageProblem solving techniques in c language
Problem solving techniques in c language
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
 
Data_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptData_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.ppt
 
Important C program of Balagurusamy Book
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy Book
 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
 
Problem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialProblem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study material
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 

Problem solving and design

  • 2. STAGES OF PROGRAM DEVELOPMENT  PROBLEM DEFINITION  ANALYSIS  DESIGN A SOLUTION USING AN ALGORITHM  WRITE A COMPUTER PROGRAM  TEST AND DEBUG THE PROGRAM  DOCUMENT THE PROGRAM Problem- Solving Phase Implementation Phase
  • 3. PROBLEM SOLVING PHASE: STEP 1: Define the problem STEP 2: Find the solution to the problem STEP 3: Evaluate alternative solutions STEP 4: Represent the most efficient solution as an algorithm STEP 5: Test the algorithm for correctness
  • 4. STAGE 1: DEFINING THE PROBLEM Stating what the problem is and what the end result should be. A problem should be decomposed into 3 key components: 1. INPUT 2. PROCESS 3. OUTPUT
  • 5. DEFINING THE PROBLEM INPUT (What is given) OUTPUT (The expected output) PROCESS (Tasks that must be performed)
  • 6. Example:  Write a program that enters a student name and date of birth and calculate the child’s age and write the name and age of the child.
  • 7. PROBLEM DEFINITION:  Required to find the age of a child  DEFINING DIAGRAM INPUT PROCESS OUTPUT 1. Student Name Calculate the child’s age 1. Student Name 2. Student DOB From the child’s DOB 2. Student Age
  • 8. Questions 1. Write a program that is required to read three (3) numbers, calculate and print their total. 2. Give three integers representing the age of three boys respectively, write a program to find their average and also determine the age of the oldest boy. 3. Write a program to enter the base and height of a triangle and find and print the area. 4. Write a program to read the temperature in degrees Celsius and convert it to degrees Celsius and Fahrenheit.
  • 9. PROBLEM DEFINITIONS: 1. Required to find the Total of three numbers. 2. Required to find the average age of 3 boys and the age of the oldest boy. 3. Required to find the Area of a triangle. 4. Required to find the Fahrenheit equivalent of a temperature in degrees Celsius.
  • 10. DEFINING DIAGRAM: QUES. 1 INPUT PROCESS OUTPUT NUM1 GET NUM1, NUM2, NUM3 TOTAL/SUM NUM2 CALCULATE TOTAL USING NUM1, NUM2,NUM3 NUM3 DISPLAY TOTAL
  • 11. QUES. 2 INPUT PROCESS OUTPUT AGE1 1. Read AGE1, AGE2, AGE3 1.AVERAGE AGE AGE2 2. CALCULATE AVERAGE AGE USING AGE1, AGE2, AGE3. 2. AGE OF OLDEST BOY AGE 3 3. FIND AGE OF OLDEST BOY FROM AGE1, AGE2, AGE3 4. DISPLAY AVERAGE, AGE OF OLDEST BOY
  • 12. QUES. 3 INPUT PROCESS OUTPUT BASE READ BASE, HEIGHT AREA OF TRIANGLE HEIGHT CALCULATE AREA USING BASE AND HEIGHT DISPLAY AREA
  • 13. QUES. 4 INPUT PROCESS OUPUT DEGREES CELCIUS READ DEGREES CELCIUS DEGREES FAHRENHEIT CALCULATE DEGREES FAHRENHEIT USING DEGREES CELCIUS DISPLAY DEGREES FAHRENHEIT
  • 14. ALGORITHMS  An algorithm is a series of steps to be followed to perform a task. An algorithm should be: 1. Precise 2. Unambiguous 3. Finite (i.e. terminate after a given number of steps) 4. Instructions must be in Logical order
  • 15. Questions 1. Identify which of the options gives the steps in correct sequence: (a) Get on the bus, get dressed for school, get off the bus at school (b) Get dressed for school, get off the bus at school, get on the bus (c) Get off the bus at school, get on the bus, get dressed for school (d) Get dressed for school, get on the bus, get off the bus at school 2. Consider the following algorithms & identify which one accurately gives the area of a square: (a) Get length and width Area = length x width (b) Get side measurement of square Area = side x side (c) Get area of square Area =Area x 2 (d) Get side measurement of square Area = side x 4
  • 16. 3. Consider the following algorithm and choose the correct step to make it complete: Purchase some ice-cream and toppings Get ice-cream scoop Use scoop to place two scoops of ice-cream on cone Cover with sprinkles Add a cherry to the top (a) Eat cake (b) Go to the cinema (c) Purchase cone (d) Enjoy the movie
  • 17. VARIABLES  A Variable is a location in memory where data of different types are stored. When you declare a variable the computer sets aside a location in memory to store data. num1 num2 sum E.g. var num1, num2, sum: integer;
  • 18.  A variable can be given a value or a variable can be set to a specific value. E.g. num1:= 1 Or the user inputs the value for num1 (1, 2, 3, 5, 90, etc.)
  • 19.  A variable can hold ONLY one value at a time. If a new value is entered, the old one is lost. e.g. 5 is currently being stored in the num1 memory location with the label, num1 (variable). If you enter a new value, say 15 for the variable num1, the value 5 is replaced by the value num1 15. 5 15
  • 20. 1)Write a program that is required to read three (3) numbers, calculate and print their total. 2)Write a program to enter girls’ heights. Calculate the average height of the girls. • Underline the variables in your program! 3)Identify all the variables in the program AreaOfSquare.
  • 21. 1. Write an algorithm to find the sum of two numbers and display the sum. 2. Write an algorithm to enter the name of an item, Cost Price of an item, the number of items purchased; calculate the Total Cost of items and display the name of the item and total cost of the items. 3. Write an algorithm to enter a student’s name, three marks; calculate the average mark. Display the student’s name and average mark.
  • 22. Program AreaOfSquare; var s, a: integer; Begin write(‘Enter length of side:’); read (s); {store length in s} a:= s*s; {calculate area; store in a} writeln; {print a blank line} writeln(‘Area of square is’, a); End.
  • 23. VARIABLE NAMES/Identifiers The variable name can: • Start with a letter or underscore • Be a combination of letters, digits and underscore • The length of the variable name cannot exceed 31 characters • No spaces are allowed in the variable names
  • 24. Exercise:  Identify the valid and invalid variable names: R _XYZ Alpha;beta Net Pay Maxamt Root1 2hottohandle
  • 25. DATA TYPES  Integer  Real (floating point)  String  Boolean (data which can be true or false)  Character (data consisting of a single character)
  • 26. Examples of data types:  Integer:- 3, -59, 0, 1987  Real:- 3.142, -5.0, 1.16  Boolean:- True or False  Character- ‘k’, ‘8’  String:- ‘Hi there’
  • 27. ALGORITHMIC STRUCTURE  Header- Algorithm’s name or title  Declaration- A brief description of algorithm and variables used.  Body- sequence of steps  Terminator- end statement
  • 28. PSEUDOCODE  An outline of a program, written in a form that can easily be converted into real programming statements.
  • 29. CONTROL STRUCTURES  SEQUENCE  SELECTION  REPETITION (LOOP)
  • 30. SEQUENTIAL STRUCTURE  INPUT STATEMENTS. For example, A. Get num1, num2 B. Read price • OUTPUT STATEMENTS. For example, A. Print Total_Cost B. Display Average • Statements with arithmetic operations: A. Sum = num1 + num2 • Statements that assign values to variables: A. Count = 0 B. Max = 20
  • 31. SELECTION STRUCTURE  IF-THEN-ELSE A. If (A>B) then Display A B. If (age>= 50) Print “Old” Else Print “Young”
  • 32. REPETITION: LOOP A. While (price <> 0) do read price total = total + price End while B. Repeat 10 times Print “I am good looking” End Repeat
  • 33. FLOWCHARTS  Algorithms can also be expressed as flowcharts. A flowchart is a pictorial representation of an algorithm.  A parallelogram- represents the input & output operation.  A rectangle- used to represent processing/assignment statements.  A diamond- represents a decision (if-then-else).  An elliptical shape- represents terminal indicators.  Directional arrows- indicate the flow of logic in the program.
  • 41. ARRAYS  An array is a special variable where we reserve a series of locations in memory to store data items of a certain data type. These related data items are of the same data type.
  • 42. DECLARING AN ARRAY  Example: var MARKS: Array[1..35] of integer; Reserved word Variable Name Group of 35 Data type MARKS is the name of the entire array. In order to access one data item the subscript is used. MARKS 1 2 3 4 5