[go: up one dir, main page]

0% found this document useful (0 votes)
5 views22 pages

Chapter 05 Flowcharts and Algorithm Updated

Chapter 3 of the Information Technology Fundamentals course focuses on programming fundamentals, including planning solutions, communication with computers, and organizing problems using flowcharts and pseudocode. It covers control structures, documentation, testing, coding, and the compilation and execution of programs. The chapter also includes examples of flowcharts and algorithms for various tasks.

Uploaded by

nama65145
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views22 pages

Chapter 05 Flowcharts and Algorithm Updated

Chapter 3 of the Information Technology Fundamentals course focuses on programming fundamentals, including planning solutions, communication with computers, and organizing problems using flowcharts and pseudocode. It covers control structures, documentation, testing, coding, and the compilation and execution of programs. The chapter also includes examples of flowcharts and algorithms for various tasks.

Uploaded by

nama65145
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 22

Faculty of Information Technology

Course Name:
Information Technology Fundamentals
Chapter 3
Programming Fundamentals
Prepared by:
Dr. Adel Hamdan
Dr. Ahmad Alfraihat
Dr. Moath Altarawneh
Planning Your Solution
• Communication with the Computer
• Organizing the problem
– Flowchart
– Internal and external documentation.
• Using the tools
• Testing the solution
• Coding the solution

2
Communication with the Computer
• Syntax refers to the rules governing the
computer operating system, the language,
and the application.
• An error is called a bug.

3
Organizing the problem
• Flow Chart: Graphic Presentation of the
problem.

4
Algorithms - Definition
• Set of instructions used to complete a task.
• Can be represented as:

– Pseudocode – list of steps, it is an English-like


description to express the solution of a given problem.

– Flowchart – graphical representation to express the


solution of a given problem.

5
What is pseudocode
• Pseudocode, like step-form, is a written way of stating algorithms
but uses a much more restricted vocabulary. It is very much like a
3GL and for many programmers and program designers is the
preferred way to state algorithms and program specifications.
• Although there is no standard for pseudocode it is generally quite
easy to read and use, for instance here is some pseudocode:
– DOWHILE kettle_empty
Add_Water_To_Kettle
END DOWHILE
• As you can see it is a precise statement of a while loop.
• Pseudocode is a written statement of an algorithm using a restricted
and well-defined vocabulary. In the next section you look at the
vocabulary in detail.

6
Control Structures
• Bohm & Jacopini showed that all programs
could be written in terms of 3 structures:

– Sequence – which instruction should be done next?


– Selection (Branched) – select between options.
– Repetition (Loop) – repeat an action while a given
condition stays true.

7
Flowchart Symbols

• Flow Line

• Start/Stop

• Input/Output

Calculation
• Processing/
Branch Test
• Decision /

8
…Flowchart Symbols

Processing I/O
Decision

Start/End Flow of logic Connector

9
Example:
Example Algorithm and
Flowchart to enter and print two
variables

10
Internal and External
Documentation
• Internal Documentation:
– Remarks written with the instruction.
• External Documentation:
– Manuals.

11
Testing the solution
• Testing is the process of executing a program with
the deliberate intent of finding errors.

• Some programmers use the terms “testing” and


“debugging” interchangeably, but careful
programmers distinguish between the two activities.

• Testing is a means of detecting errors. Debugging is


a means of diagnosing and correcting their root
causes
12
Coding

• Writing the program is called Coding.

• The logic that has been developed in the algorithm is


used to actually write the program.

• Using any programming language, the algorithm can


be converted to code (program).

13
Compiling and Running the
program
• Compiling is a process in which the source program
instructions are translated into a form that is
suitable for execution by the computer (object code).

• The compiler does the translation after examining


each instruction for its correctness. The translation
results in the creation of object code.

• After compilation, the program can be executed.


executed
During execution (Running), the executable object
code is loaded into the computer memory and the
program instructions are executed.

14
…Example 1

• Sketch a simple flowchart that will find


the sum of two numbers and their
difference.
difference

15
Example 1 answer

You can use read


or input instead of
get
and use write or
print instead of
display

16
…Example 2
• Draw a flowchart and write the steps to
compute the area of a rectangle.

17
Example 2 answer

18
…Example 3
• Draw a flowchart and write the steps to
print “Pass” if the average of 4 numbers is
greater than or equal to 50 or print “Fail”
otherwise.

19
Example 3 answer

20
…Example 4
• Draw a flowchart to find the maximum
number of two numbers.

21
Example 4 answer

22

You might also like