Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Programming 12 Lesson 2 - Organizing the Problem By Dan Lunney.

Similar presentations


Presentation on theme: "Computer Programming 12 Lesson 2 - Organizing the Problem By Dan Lunney."— Presentation transcript:

1 Computer Programming 12 Lesson 2 - Organizing the Problem By Dan Lunney

2 Tools for Organizing Problems Problem Analysis Chart Problem Analysis Chart Interactivity or Structure Chart Interactivity or Structure Chart IPO Chart IPO Chart Algorithms Algorithms Flowcharts Flowcharts Internal and External Documentation Internal and External Documentation

3 Problem Analysis Chart Contains four parts Contains four parts Given data Given data Required results Required results Processing Processing List of solution alternatives List of solution alternatives Comes in the form of a chart Comes in the form of a chart

4 Problem Analysis Chart (cont.) Given Data Required Result Information we know Information we need to find Processing Solution Alternatives How to determine required information List of ideas for the solution of the problem

5 Problem Analysis Chart (cont.) Sample problem: Sample problem: Calculate the area of a circle for any given radius Calculate the area of a circle for any given radius

6 Problem Analysis Chart (cont.) Given Data Required Result Processing Solution Alternatives Pi Radius 1.Set both radius and pi in program 2.Get both radius and pi from user 3.Set pi and get radius 4.Set radius and get pi Area = pi * radius * radius Area of the circle

7 Interactivity or Structure Chart Organizes the problem into sub- tasks Organizes the problem into sub- tasks Often looks like an organizational chart or web diagram Often looks like an organizational chart or web diagram

8 Interactivity or Structure Chart (cont.) Control 0000 Module 1 1000 Module 2 2000 Module 3 3000

9 Interactivity or Structure Chart (cont.) Area of Circle Control 0000 Read 1000 Calculate 2000 Display 3000

10 IPO Chart Input/Processing/Output Input/Processing/Output Contains 4 Columns Contains 4 Columns Input Input Processing Processing Module Reference Module Reference Output Output Looks like a chart Looks like a chart

11 IPO Chart (cont.) InputProcessing Module reference Output All know data from PAC (problem analysis chart) All processes that are required Module number where it takes place Result

12 IPO Chart (cont.) InputProcessing Module reference Output RadiusPi 1. Enter Radius 2. Get pi value 3. Calculate area 4. Display Area 1000200020003000Area

13 Algorithms An algorithm is a set of step-by- step instructions An algorithm is a set of step-by- step instructions Sometimes called Pseudocode Sometimes called Pseudocode It is the key component to solving any problem It is the key component to solving any problem Cannot assume anything, cannot skip steps, must be executable one step at a time, must be complete Cannot assume anything, cannot skip steps, must be executable one step at a time, must be complete

14 Algorithms Control module (name of module) Control module (name of module) 1. Instruction 1. Instruction 2. Instruction 2. Instruction 3. Instruction 3. Instruction... Exit Exit

15 Algorithms Area of Circle Control Module Area of Circle Control Module(0000) 1. Process Read 1. Process Read 2. Process Calculate 2. Process Calculate 3. Process Display 3. Process Display 4. Exit 4. Exit

16 Algorithms Read Module Read Module(1000) 1. Read radius 1. Read radius 2. Exit 2. Exit

17 Algorithms Calculate Module Calculate Module(2000) 1. area = pi * radius * radius 1. area = pi * radius * radius 2. Exit 2. Exit

18 Algorithms Display Module Display Module (3000) (3000) 1. Print area 1. Print area 2. Exit 2. Exit

19 Flowchart Programmers use algorithms to create flowcharts Programmers use algorithms to create flowcharts Flowcharts are graphic representations of the algorithms Flowcharts are graphic representations of the algorithms Flowcharts have symbols to represent parts of the program Flowcharts have symbols to represent parts of the program Often flowcharts will show errors that may not been seen easily in other organizing charts Often flowcharts will show errors that may not been seen easily in other organizing charts

20 Flowchart Symbols Data flow line Start/Stop/Exit Process Decision Input/Output Module

21 Flowchart Example To see a demonstration of how to create a flowchart click the link: To see a demonstration of how to create a flowchart click the link: Sample flowchart video Sample flowchart video Sample flowchart video Sample flowchart video

22 Flowchart Sample Control Read Calculate Display Exit

23 Flowchart Sample (cont.) Read Calculate Display Exit Read radius Area = pi * pi * radius Print area

24 Internal / External Documentation Internal documentation – notes written inside the program for other programmers to read. Lets them know what parts of the program are doing. Internal documentation – notes written inside the program for other programmers to read. Lets them know what parts of the program are doing. External documentation – usually consists of the user manuals for your program so the end user can fully understand how to install and use your program. External documentation – usually consists of the user manuals for your program so the end user can fully understand how to install and use your program.

25 Sample Problem – Lesson 2 Create a PAC, Structure Chart, IPO Chart, Algorithms, and Flowcharts for the following problem: Create a PAC, Structure Chart, IPO Chart, Algorithms, and Flowcharts for the following problem: Calculate the gross pay for employees based on rate, hours, and overtime hours Calculate the gross pay for employees based on rate, hours, and overtime hours See sample problem sheet See sample problem sheet See sample problem sheet See sample problem sheet


Download ppt "Computer Programming 12 Lesson 2 - Organizing the Problem By Dan Lunney."

Similar presentations


Ads by Google