Presentation is loading. Please wait.

Presentation is loading. Please wait.

Problem-solving with Computers. 2Outline  Computer System  5 Steps for producing a computer program  Structured program and programming  3 types of.

Similar presentations


Presentation on theme: "Problem-solving with Computers. 2Outline  Computer System  5 Steps for producing a computer program  Structured program and programming  3 types of."— Presentation transcript:

1 Problem-solving with Computers

2 2Outline  Computer System  5 Steps for producing a computer program  Structured program and programming  3 types of control structure  Algorithm  Tools for describing an algorithm  Examples of algorithm and programs

3 3 Computer System Software Hardware InputOutput  A Computer system is a collection of hardware and software.

4 4 Computer System  Hardware  the electric, electronic, and mechanical equipment that makes up a computer  Software  the series of instructions that tells the hardware how to perform tasks

5 5 Computer System  Hardware : requires a series of instructions to carry out its processing function.  Software : a group of instructions (computer program) which command a computer to take action and to make decision.  Without software, hardware is useless; hardware needs the instructions provides by software to process data into information.

6 6 Computer Program (Software)  A program is a sequence of instructions suitable for processing by a computer  Programs are written  for controlling the computer hardware oInstructions in a program tell the hardware to perform a task  for solving problems. Without software, the hardware doesn’t know what to do !!

7 7 Computer System  Algorithm  describe the method in a sequence of steps to get a computer to perform a task.  An Algorithm must be translated into a program by coding in a programming language.

8 8 Computer Program (Software)  The activities of expressing an algorithm of a problem and translating the algorithm as a program is called programming. The most fundamental concepts of computer science is programming and algorithm.

9 9 5 Major Steps for Producing a Computer Program  Problem Definition  Understanding the problem  Problem Design  Proposing the solution  Problem Coding  Implementing the solution  Problem Testing  Testing the solution  Problem Documentation  Writing the document

10 10 Problem Definition Problem Definition  Have a clear understanding the problem  What we want to do  specify objectives  specify the desired input and output

11 11 Problem Design Problem Design  Proposing the solution  Top-down design with modularity approach using hierarchy chart  Input/output and data structure design  Algorithm design with certain tools o Pseudocode o Flowchart

12 12 Problem Coding Problem Coding  Implementing the solution  Write (code) the program from algorithm by using selected programming language Program = Algorithm + Data Structure

13 13 Problem Testing Problem Testing  Testing the solution  Structured walk-through  Desk checking  Sample test data

14 14 Problem Documentation Problem Documentation  Writing the document  User documentation  Program documentation  Program Maintenance

15 15 Structure Program and Programming Structure Program and Programming  Technique for organizing and coding computer programs  Hierarchy of modules is used  Single entry  Single exit point  Control is passed downward through the structure without unconditional branches to higher levels of the structure

16 16 Structure Program and Programming Structure Program and Programming  Module  A self-contained activities that contributes a specific subtask.  The overall task is done in a logical order of the hierarchy of the subtasks.

17 17 Example of Top-down Design Example of Top-down Design (with Modularity approach using a hierarchy chart) Payroll System InputPayment ProcessingOutput Compute PayCompute Payroll Deduction Regular Pay Overtime Pay Payroll Saving Tax

18 18 Problem Solving with Computer Problem Solving with Computer Problem Solution in a computer program Solution in a algorithm form Difficult in solving big problem Problem solving phase Implementation phase

19 19 Structure Program and Programming Structure Program and Programming  3 types of control flow (structure)  Sequence  Selection or branching  Iteration or looping Explain on the blackboard

20 20 Sequence Sequence Statement #1 Statement #2 Statement #3 read X read Y Z = X + Y print (“The sum of X and Y is ”, Z)Example Statement #1 Statement #2 Statement #3

21 21 Selection Selection if condition then Statement #1 else Statement #2 condition Statement #2Statement #1 FalseTrue

22 22Selection read X read Y if then if ( X > Y ) then print (“ X is greater than Y”) else else print (“ Y is greater than X”)Example if condition then Statement #1 else Statement #2

23 23 Iteration (Repeat Loop) Iteration (Repeat Loop) repeat Statements until condition condition Statements False True

24 24 Iteration (Repeat Loop) Iteration (Repeat Loop) repeat Statements until condition read X read Y repeat repeat print X X = X+1 until until (X >Y)Example

25 25 Iteration (While Loop) Iteration (While Loop) while condition do Statements condition Statements False True

26 26 Iteration (While Loop) Iteration (While Loop) read X read Y while while (X<=Y) do do print X X = X+1Example while condition do Statements

27 27 Iteration (For Loop) for i = 1 to n do Statements i <= n Statements False 1  i i = i + 1 True

28 28 Iteration (For Loop) for i = 1 to n do Statements read X read Y for for i = 1 to X do do print (“The value of i is ”, i) Example


Download ppt "Problem-solving with Computers. 2Outline  Computer System  5 Steps for producing a computer program  Structured program and programming  3 types of."

Similar presentations


Ads by Google