1 / 10

Lesson 5 Program Flowchart

Lesson 5 Program Flowchart. Design tool commonly used in designing input, output and process flow of a program A graphical representation of the program logic using standard symbols (NCC Symbols) Using three primary program constructs; sequence, selection and iteration/repetition.

chafin
Download Presentation

Lesson 5 Program Flowchart

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lesson 5Program Flowchart • Design tool commonly used in designing input, output and process flow of a program • A graphical representation of the program logic using standard symbols (NCC Symbols) • Using three primary program constructs; sequence, selection and iteration/repetition

  2. Three Program Constructs in Flowchart • Sequence • A sequential execution of process. Each instruction is executed in a serial manner, one after another • Selection • Provide a decision point that allows one of two choices to be chosen • Iteration • Repeat a set of instructions a number of times based on condition stated. This loop will end when condition has been fulfilled

  3. Symbols Used in Program Flow Chart • Processing • Program flow • Decision • Terminal • Connector • Input/Output

  4. Start Get number1 Get number2 answer = number1 / number2 Display answer Stop Sequence Example:

  5. Start Get number1 Get number2 number2= 0? yes Display "Division by zero error" answer = number1 / number2 Display answer Stop Selection Example 1

  6. Start Display main menu Get choice choice =1? yes Display "choice 1 selected" no choice =2? yes Display "choice 2 selected" no choice =3? yes Display "choice 3 selected" no choice =4? yes Display "choice 4 selected" no Stop Selection Example 2

  7. Start total = 0 Get number number < 1000? no Display total Stop yes total = total + number2 Iteration Example 1

  8. Start i = 1 i <= 12? no Stop yes result = i * 9 Display (i, "*9=",result) i = i + 1 Iteration Example 2

  9. Connector Example • A program to accept input of a series of numbers and total up value entered until ‘0’ is entered. Then display number of data entered and total

  10. Exercises • Draw a flowchart for a program that accepts an amount entered through the keyboard. Then, determine the discount rate allowed; 20% would be given to any purchase of more than $1000, 10% to purchase of more than $500 (inclusive). Display the discount given and also the amount after the deduction of the discount. • Draw a flowchart for a program which prompt the user to enter his/her name & age and determine whether he/she is an adult or not. If he/she is below 20 years old the user would be a teenager else he/she would be an adult. The user will be prompted after each person, if he/she wishes to enter anymore names. The program continues to run until the user enters ‘NO’ or ‘N’.

More Related