You are on page 1of 24

Click to edit Master title style

Unit 7-Algorithm design and


problem solving
Program development life cycle
Computer science
Grade 8
Teacher Ms. Resmi
Date- 10/01/2024
Click to edit Master title style

Learning Outcomes:
By the end of this lesson, you should be able to Understand
the program development life cycle.
Click to edit Master title style
Requirements
• Identification of the problem: Before tackling a problem, it
needs to be clearly understood by everyone working on it.
Requirements: To create a solution, a requirements
document is created to define the problem and break it down
into clear, manageable, understandable parts by using
abstraction and decomposition.
Click to edit Master title style
Decomposition
• This is the act of breaking down a large problem into smaller, clear,
manageable and understandable sub-parts. Sub-parts can be divided until
they are easily solvable and cannot be broken down any further. An example
of decomposition could be getting ready in the morning to go to school
• Step 1: Wake up
• Step 2: Get breakfast
• Step 3: Brush teeth
• Step 4: Put clothes on
• Step 5: Make sure the bag and school supplies are ready
• Step 6: Find transport to school e.g. walk, bus, car, bike, etc
Click to edit Master title style
• These steps could be further subdivided, for example, “Step
2: Get breakfast” would entail:
• Step 2.1 Get a bowl
• Step 2.2 Get cereal
• Step 2.3 Get milk
• Step 2.4 Get a spoon
• Step 2.5 Put cereal in a bowl
• And so on…
Click to edit Master title style
• Decomposing a system
• To create an overall system and solve a problem, it must first
be broken down into subsystems that are easier to solve and
create. The act of breaking down the problem is known as
stepwise refinement
• Decomposing the problem this way creates smaller, more
manageable and more easily understandable sub-parts
Click to edit Master title style
Structure Diagrams

• Structure diagrams show


hierarchical top-down design
in a visual form. Each
problem is divided into sub-
problems and each sub-
problem divided into further
sub-problems.
Click to edit Master title style
workout
• A satellite navigation system is an example of a computer
system that is made up of subsystems. Part of a satellite
navigation system: allows the user to enter details for a new
destination or select a previously saved destination and
displays directions in the form of a visual map or as a list.
Draw a structure diagram for this part of the satellite
navigation system.
Click to edit Master title style
Click to edit Master title style
Unit 7-Algorithm design and
problem solving
Flowchart
Computer science
Grade 8
Teacher Ms. Resmi
Date- 15/01/2024
Click to edit Master title style

Flowcharts show how algorithms can be


represented visually in a diagrammatic format
Each flowchart has a start and an end with arrows
showing the order each task or instruction needs
to be carried out in
Flowcharts are made of several symbols:
Click to edit Master title style
Pseudocode
• Pseudocode is a programming-like language that does not have
syntax. It can be considered “fake” code.
• It uses english words and phrases to represent instructions and
is very similar to programming code but does not and cannot
run on any computer
• The purpose of pseudocode is to allow developers to understand
how to create a program regardless of the programming
language used to implement the solution
• While pseudocode has no specific syntax, it is important to stick
to a consistent style. This will make it easier and quicker for
programmers to read and create programs from the pseudocode
Click toCode
Writing edit Master title style

• Developers begin programming modules in a suitable


programming language that works together to provide an overall
solution to the problem
• As each developer programs, they perform iterative testing. Iterative
testing is where each module is tested and debugged thoroughly to
make sure it interacts correctly with other modules and accepts data
without crashing or causing any errors. Developers may need to
retest modules as new modules are created and changed to make
sure they continue to interact correctly and do not cause errors
Click to edit Master title style
• Find the sum of two numbers
• Draw a flowchart
• Write pseudocode
• Create a program in python
Click to edit Master title style

Flowcahrt
Click to edit Master title style
Pseudocode
• OUTPUT (“Enter the first number”)
• INPUT Num1
• OUTPUT(“Enter the second number”)
• INPUT Num2
• sum->Num1+Num2
• OUTPUT(sum)
Click to edit
Program python
Master title style
• Num1=input("Enter the first number")
• Num2=input("Enter the second number")
• Sum=int(Num1)+int(Num2)
• print(Sum)
Click to edit Master title style
Unit 7-Algorithm design and
problem solving
Pseudocode and programming
Computer science
Grade 8
Teacher Ms. Resmi
Date- 16/01/2024
Common
Click tokeywords used in title
edit Master pseudocode
style
• 1.BEGIN,END: Begin is the first statement and end is the last statement.
• 2. INPUT, GET, READ: The keyword is used to inputting data.
• 3.COMPUTE, CALCULATE: used for calculation of the result of the given expression.
• 4. ADD, SUBTRACT, INITIALIZE used for addition, subtraction and initialization.
• 5.OUTPUT, PRINT, DISPLAY: It is used to display the output of the program.

• 6. IF, ELSE, ENDIF: used to make decision.

• 7. WHILE, ENDWHILE: used for iterative statements.

• 9. FOR, ENDFOR: Another iterative incremented/decremented tested automatically.


Click to-pseudocode
Rules edit Master title style
• Capitalize the construct keyword.
• Apply one construct per line unless pairing it with a construct
like IF-THEN.
• Use plain language that describes the problem.
• Use the phrase END plus the construct keyword to show that
an element of pseudocode is complete, such as ENDFOR and
ENDWHILE.
Click to edit Master title style
Solve
• Write algorithms and draw flowcharts for the following:
• Accept the age of a person and check whether he/she is
eligible to vote or not. A person is eligible to vote only
when he/she is 18 years or more.
• Draw a flowchart
• Write pseudocode
• Create a program in python
Click to edit Master title style

Flowchart
Click to edit Master title style
Pseudocode
• BEGIN
• INPUT age.
• IF age <=18 THEN
• PRINT “You are not eligible to vote"
• ELSE
• PRINT " You are eligible to vote "
• END IF
• END
Click to edit Master
Programming Pythontitle style

• age = int(input("Enter your age: "))


• if age >= ’18’:
• print("You are not eligible to vote!")
• else:
• print("you are not eligible to vote.")

You might also like