SlideShare a Scribd company logo
1 of 39
Flow Chart and Phases of Making
an Executable Code
Drawing Flowcharts
– Flowchart is the graphic representations of the individual
steps or actions to implement a particular module
– Flowchart can be likened to the blueprint of a building
– An architect draws a blueprint before beginning
construction on a building, so the programmer draws a
flowchart before writing a program
– Flowchart is independent of any programming language.
Flow Charts
A flow chart is an
organized
combination of shapes,
lines and
text that graphically
illustrate a
process or structure.
PRE-PROGRAMMING PHASE
Symbol Function
Show the direction of data flow or logical
solution.
Indicate the beginning and ending of a set of
actions or instructions (logical flow) of a module
or program.
Indicate a process, such as calculations,
opening and closing files.
PRE-PROGRAMMING PHASE
Indicate input to the program and output from the
program.
Use for making decision. Either True or False based
on certain condition.
Use for doing a repetition or looping of certain steps.
Connection of flowchart on the same page.
Connection of flowchart from page to page.
Sequential Logic Structure
Sale Problem
Given the unit price of a product and the quantity of the
product sold, draw a flowchart to calculate and print the
total sale.
Solution: Stepwise Analysis of the Sale Problem
• Read the unit price and the quantity
• Calculate total sale = unit price and quantity
• Print total sale
PRE-PROGRAMMING PHASE
START
READ
UNIT PRICE
READ
QUANTITY
A
A
TOTAL SALE =
UNITPRICE  QUANTITY
PRINT
TOTALSALE
STOP
Find the average of three numbers
The Decision Logic Structure
• Implements using the IF/THEN/ELSE instruction.
• Tells the computer that IF a condition is true, THEN
execute a set of instructions, or ELSE execute another
set of instructions
• ELSE part is optional, as there is not always a set of
instructions if the conditions are false.
• Algorithm:
IF <condition(s)> THEN
<TRUE instruction(s)>
ELSE
<FALSE instruction(s)
Decision Logic Structure
Examples of conditional expressions
• A < B (A and B are the same data type –
either numeric, character, or string)
• X + 5 >= Z (X and Z are numeric data)
• E < 5 or F > 10 (E and F are numeric data)
• DATAOK (DATAOK – logical datum)
Conditional Pay Calculation
• Assume your are calculating pay at an hourly
rate, and overtime pay(over 40 hours) at 1.5
times the hourly rate.
– IF the hours are greater than 40, THEN the pay is
calculated for overtime, or ELSE the pay is
calculated in the usual way.
Example Decision Structure
NESTED IF/THEN/ELSE INSTRUCTIONS
• Multiple decisions.
• Instructions are sets of instruction in which
each level of a decision is embedded in a level
before it.
NESTED IF/THEN/ELSE INSTRUCTIONS
Flow Chart - Selectional
Iterational Structure
• Repeat structure
• To solve the problem that doing the same task
over and over for different sets of data
• Types of loop:
– WHILE loop
– Do..WHILE loop
– Automatic-Counter Loop
Loop Logic Structure
WHILE loop
WHILE loop
• Do the loop body if the condition is true.
• Example: Get the sum of 1, 2, 3, …, 100.
– Algorithm:
• Set the number = 1
• Set the total = 0
• While (number <= 100)
– total = total + number
– number = number + 1
• End While
• Display total
WHILE loop
Start
Set number = 1
number <= 100
Set total = 0
total =
total + number
number =
number + 1
Display total
End
No
Yes
Automatic Counter Loop
• Use variable as a counter that starts counting at
a specified number and increments the variable
each time the loop is processed.
• The beginning value, the ending value and the
increment value may be constant.
• They should not be changed during the
processing of the instruction in the loop.
Automatic-Counter Loop
Automatic-Counter Loop
NESTED LOOP
NESTED LOOP
Example (Iterational)
• Write a program to find the average of marks
scored by him in three subjects for ‘N’
students. And then test whether he passed or
failed. For a student to pass, average should
not be less than 65.
Flow Chart Iterational
Tool demo
• Yed tool shall be used for giving demo
Pseudocode – Partial English and
Programming Language terms
Programming Or Implementation Phase
• Transcribing the logical flow of solution steps in
flowchart or algorithm to program code and run the
program code on a computer using a programming
language.
• Programming phase takes 5 stages:
• Coding.
• Compiling.
• Debugging.
• Run or Testing.
• Documentation and maintenance.
Programming Or Implementation Phase
• Once the program is coded using one of the
programming language, it will be compiled to ensure
there is no syntax error.
• Syntax free program will then be executed to
produce output and subsequently maintained and
documented for later reference.
DOCUMENTATION OR
MAINTENANCE
EXECUTE OR
RUN
MAKE
CORRECTION
COMPILE THE
PROGRAM
CODING
NO SYNTAX
ERROR
Coding
– Translation or conversion of each operation in the
flowchart or algorithm (pseudocode) into a computer-
understandable language.
– Coding should follow the format of the chosen
programming language.
Compiling and Debugging
– Compiling - Translates a program written in a particular high–
level programming language into a form that the computer can
understand
– Compiler checks the program code so that any part of source
code that does not follow the format or any other language
requirements will be flagged as syntax error.
– This syntax error in also called bug, when error is found the
programmer will debug or correct the error and then recompile
the source code again
– Debugging process is continued until there is no more error in
program
Testing
– The program code that contains no more error is called
executable program. It is ready to be tested.
– When it is tested, the data is given and the result is verified so
that it should produced output as intended.
– Though the program is error free, sometimes it does not
produced the right result. In this case the program faces logic
error.
– Incorrect sequence of instruction is an example that causes
logic error.
Documentation and Maintenance
– When the program is thoroughly tested for a substantial
period of time and it is consistently producing the right
output, it can be documented.
– Documentation is important for future reference. Other
programmer may take over the operation of the program
and the best way to understand a program is by studying
the documentation.
– Trying to understand the logic of the program by looking at
the source code is not a good approach.
– Studying the documentation is necessary when the
program is subjected to enhancement or modification.
– Documentation is also necessary for management use as
well as audit purposes.
Best Practices
Develop efficient computer solution to problems:
1. Use Modules
2. Use four logic structures
a. Sequential structure
• Executes instructions one after another in a sequence.
b. Decision structure
• Branches to execute one of two possible sets of instructions.
c. Loop structure
• Executes set of instruction many times.
d. Case structure
• Executes one set of instructions out of several sets.
3. Eliminate rewriting of identical process by using modules.
4. Use techniques to improve readability including four logic structure,
proper naming of variables, internal documentation and proper
indentation.

More Related Content

Similar to Cse

Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem slovingMani Kandan
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdfNayanChandak1
 
Software develop....
Software develop.... Software develop....
Software develop.... GCWUS
 
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
 
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxCOMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxSherinRappai1
 
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxCOMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxSherinRappai
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithmmshoaib15
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life CycleFrankie Jones
 
Cs1123 2 comp_prog
Cs1123 2 comp_progCs1123 2 comp_prog
Cs1123 2 comp_progTAlha MAlik
 
LESSON__1-15 C-PROGRAMMING.p algorithm df
LESSON__1-15 C-PROGRAMMING.p algorithm dfLESSON__1-15 C-PROGRAMMING.p algorithm df
LESSON__1-15 C-PROGRAMMING.p algorithm dfAparnaPriyadarsiniMe
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptxshoaibkhan716300
 
Algorithm and Flowcharts
Algorithm and FlowchartsAlgorithm and Flowcharts
Algorithm and FlowchartsSURBHI SAROHA
 
Introduction to testing.
Introduction to testing.Introduction to testing.
Introduction to testing.Jithinctzz
 
Algorithm & Flowchart.pdf
Algorithm & Flowchart.pdfAlgorithm & Flowchart.pdf
Algorithm & Flowchart.pdfVpmv
 
Logic Formulation 1
Logic Formulation 1Logic Formulation 1
Logic Formulation 1deathful
 

Similar to Cse (20)

pccf unit 1 _VP.pptx
pccf unit 1 _VP.pptxpccf unit 1 _VP.pptx
pccf unit 1 _VP.pptx
 
Debbuging
DebbugingDebbuging
Debbuging
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem sloving
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
 
Software develop....
Software develop.... Software develop....
Software develop....
 
FPL -Part 2 ( Sem - I 2013)
FPL -Part 2 ( Sem - I 2013)FPL -Part 2 ( Sem - I 2013)
FPL -Part 2 ( Sem - I 2013)
 
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxCOMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
 
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxCOMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithm
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle
 
Cs1123 2 comp_prog
Cs1123 2 comp_progCs1123 2 comp_prog
Cs1123 2 comp_prog
 
LESSON__1-15 C-PROGRAMMING.p algorithm df
LESSON__1-15 C-PROGRAMMING.p algorithm dfLESSON__1-15 C-PROGRAMMING.p algorithm df
LESSON__1-15 C-PROGRAMMING.p algorithm df
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptx
 
Algorithm and Flowcharts
Algorithm and FlowchartsAlgorithm and Flowcharts
Algorithm and Flowcharts
 
Introduction to testing.
Introduction to testing.Introduction to testing.
Introduction to testing.
 
DISE - Programming Concepts
DISE - Programming ConceptsDISE - Programming Concepts
DISE - Programming Concepts
 
session-4.pptx
session-4.pptxsession-4.pptx
session-4.pptx
 
Beekman5 std ppt_13
Beekman5 std ppt_13Beekman5 std ppt_13
Beekman5 std ppt_13
 
Algorithm & Flowchart.pdf
Algorithm & Flowchart.pdfAlgorithm & Flowchart.pdf
Algorithm & Flowchart.pdf
 
Logic Formulation 1
Logic Formulation 1Logic Formulation 1
Logic Formulation 1
 

Recently uploaded

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 

Recently uploaded (20)

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 

Cse

  • 1. Flow Chart and Phases of Making an Executable Code
  • 2. Drawing Flowcharts – Flowchart is the graphic representations of the individual steps or actions to implement a particular module – Flowchart can be likened to the blueprint of a building – An architect draws a blueprint before beginning construction on a building, so the programmer draws a flowchart before writing a program – Flowchart is independent of any programming language.
  • 3. Flow Charts A flow chart is an organized combination of shapes, lines and text that graphically illustrate a process or structure.
  • 4. PRE-PROGRAMMING PHASE Symbol Function Show the direction of data flow or logical solution. Indicate the beginning and ending of a set of actions or instructions (logical flow) of a module or program. Indicate a process, such as calculations, opening and closing files.
  • 5. PRE-PROGRAMMING PHASE Indicate input to the program and output from the program. Use for making decision. Either True or False based on certain condition. Use for doing a repetition or looping of certain steps. Connection of flowchart on the same page. Connection of flowchart from page to page.
  • 7. Sale Problem Given the unit price of a product and the quantity of the product sold, draw a flowchart to calculate and print the total sale. Solution: Stepwise Analysis of the Sale Problem • Read the unit price and the quantity • Calculate total sale = unit price and quantity • Print total sale
  • 8. PRE-PROGRAMMING PHASE START READ UNIT PRICE READ QUANTITY A A TOTAL SALE = UNITPRICE  QUANTITY PRINT TOTALSALE STOP
  • 9. Find the average of three numbers
  • 10. The Decision Logic Structure • Implements using the IF/THEN/ELSE instruction. • Tells the computer that IF a condition is true, THEN execute a set of instructions, or ELSE execute another set of instructions • ELSE part is optional, as there is not always a set of instructions if the conditions are false. • Algorithm: IF <condition(s)> THEN <TRUE instruction(s)> ELSE <FALSE instruction(s)
  • 12. Examples of conditional expressions • A < B (A and B are the same data type – either numeric, character, or string) • X + 5 >= Z (X and Z are numeric data) • E < 5 or F > 10 (E and F are numeric data) • DATAOK (DATAOK – logical datum)
  • 13. Conditional Pay Calculation • Assume your are calculating pay at an hourly rate, and overtime pay(over 40 hours) at 1.5 times the hourly rate. – IF the hours are greater than 40, THEN the pay is calculated for overtime, or ELSE the pay is calculated in the usual way.
  • 15. NESTED IF/THEN/ELSE INSTRUCTIONS • Multiple decisions. • Instructions are sets of instruction in which each level of a decision is embedded in a level before it.
  • 17. Flow Chart - Selectional
  • 18. Iterational Structure • Repeat structure • To solve the problem that doing the same task over and over for different sets of data • Types of loop: – WHILE loop – Do..WHILE loop – Automatic-Counter Loop
  • 21. WHILE loop • Do the loop body if the condition is true. • Example: Get the sum of 1, 2, 3, …, 100. – Algorithm: • Set the number = 1 • Set the total = 0 • While (number <= 100) – total = total + number – number = number + 1 • End While • Display total
  • 22. WHILE loop Start Set number = 1 number <= 100 Set total = 0 total = total + number number = number + 1 Display total End No Yes
  • 23. Automatic Counter Loop • Use variable as a counter that starts counting at a specified number and increments the variable each time the loop is processed. • The beginning value, the ending value and the increment value may be constant. • They should not be changed during the processing of the instruction in the loop.
  • 28. Example (Iterational) • Write a program to find the average of marks scored by him in three subjects for ‘N’ students. And then test whether he passed or failed. For a student to pass, average should not be less than 65.
  • 30. Tool demo • Yed tool shall be used for giving demo
  • 31. Pseudocode – Partial English and Programming Language terms
  • 32. Programming Or Implementation Phase • Transcribing the logical flow of solution steps in flowchart or algorithm to program code and run the program code on a computer using a programming language. • Programming phase takes 5 stages: • Coding. • Compiling. • Debugging. • Run or Testing. • Documentation and maintenance.
  • 33. Programming Or Implementation Phase • Once the program is coded using one of the programming language, it will be compiled to ensure there is no syntax error. • Syntax free program will then be executed to produce output and subsequently maintained and documented for later reference.
  • 35. Coding – Translation or conversion of each operation in the flowchart or algorithm (pseudocode) into a computer- understandable language. – Coding should follow the format of the chosen programming language.
  • 36. Compiling and Debugging – Compiling - Translates a program written in a particular high– level programming language into a form that the computer can understand – Compiler checks the program code so that any part of source code that does not follow the format or any other language requirements will be flagged as syntax error. – This syntax error in also called bug, when error is found the programmer will debug or correct the error and then recompile the source code again – Debugging process is continued until there is no more error in program
  • 37. Testing – The program code that contains no more error is called executable program. It is ready to be tested. – When it is tested, the data is given and the result is verified so that it should produced output as intended. – Though the program is error free, sometimes it does not produced the right result. In this case the program faces logic error. – Incorrect sequence of instruction is an example that causes logic error.
  • 38. Documentation and Maintenance – When the program is thoroughly tested for a substantial period of time and it is consistently producing the right output, it can be documented. – Documentation is important for future reference. Other programmer may take over the operation of the program and the best way to understand a program is by studying the documentation. – Trying to understand the logic of the program by looking at the source code is not a good approach. – Studying the documentation is necessary when the program is subjected to enhancement or modification. – Documentation is also necessary for management use as well as audit purposes.
  • 39. Best Practices Develop efficient computer solution to problems: 1. Use Modules 2. Use four logic structures a. Sequential structure • Executes instructions one after another in a sequence. b. Decision structure • Branches to execute one of two possible sets of instructions. c. Loop structure • Executes set of instruction many times. d. Case structure • Executes one set of instructions out of several sets. 3. Eliminate rewriting of identical process by using modules. 4. Use techniques to improve readability including four logic structure, proper naming of variables, internal documentation and proper indentation.