1 / 27

Chapter 5

Chapter 5. Flowcharts and programming Techniques. Introduction. A flowchart is a diagram consisting of labeled geometrical symbols together with rows connecting one symbol to another

Download Presentation

Chapter 5

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. Chapter 5 Flowcharts and programming Techniques

  2. Introduction • A flowchart is a diagram consisting of labeled geometrical symbols together with rows connecting one symbol to another • A program flowchart pictures the sequence of instructions for solving a particular problem ( usually by means of a computer program).

  3. Introduction BOUNS = 0.03 * SALARY

  4. Introduction • The sequence of instructions for solving a particular problem is called algorithm. • Express the algorithm through a flowchart • Easier to draw the flowchart than to write the program directly. • Easier to understand than program • Easy for development. • Flowcharts are independent of any particular programming language

  5. VARIABLES ,DATA-NAMES, PROGRAMMINGSATATEMENTS • a variable means a data item whose value may change during the execution of the program. • Examples:- • Salary • Bouns • AVERAGE • Assignment Statements • Salary = 500 • Bouns = 0,03*Salary • AVERAGE = ( T1+T2+T3)/3

  6. VARIABLES ,DATA-NAMES, PROGRAMMINGSATATEMENTS • HOURS = HOURS + 12 • Counter = Counter + 1

  7. Input/Output Statements • Read NUMBER, HOURS,RATE • Write NUMBER, GROSS , NET

  8. FLOWCHART SYMBLOS

  9. FLOWCHART SYMBLOS Terminal symbol Input/Output symbol

  10. FLOWCHART SYMBLOS process symbol

  11. FLOWCHART SYMBLOS Decision symbol.

  12. FLOWCHART SYMBLOS Example: A company plans to give a year-end 3% to each of its employees. However, if an employee has been working 10 or more years at the company , he is to get an additional $50.

  13. FLOWCHART SYMBLOS

  14. FLOWCHART SYMBLOS Example: The HP company plans to give a year-end 3% bonus to each of its employees earning $10,000 or more per year , and a fixed $300 bonus for the other employees.

  15. FLOWCHART SYMBLOS

  16. LOOPS AND THEIR CONTROL BY A COUNTER

  17. LOOPS AND THEIR CONTROL BY A COUNTER

  18. CONTROL OF LOOPS BYHEADER OF TRALIER RECORDS Control by a Header Record

  19. CONTROL OF LOOPS BYHEADER OF TRALIER RECORDS Control by a Trailer Record

  20. ACCUMULATORS

  21. ACCUMULATORS Example : Suppose that a company wants to find the total salary paid to its employees of a company.

  22. TWO SPECIAL ALGORITHMS: • The average of the salaries,

  23. TWO SPECIAL ALGORITHMS: The largest salary

  24. DO LOOPS

  25. DO LOOPS • Example: A company has 80 employees . Draw a flowchart to find the average salary and the number of employees earning above the average salary

  26. Example

More Related