Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Chapter 1: Introduction To Computer, Program & Programming Language

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 26

PART 3

CHAPTER 1: INTRODUCTION TO
COMPUTER, PROGRAM &
P R O G R A M M I N G L A N G UA G E

CSC126 FUNDAMENTALS OF ALGORITHMS AND


COMPUTER PROBLEM SOLVING

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 1


LESSON OUTCOMES
Upon completion of this chapter, students should be able to:

 Describe what a computer program is


 Explain the importance of programming to computer use
 Appreciate the importance of good programs
 Explain the relationship between compilers, interpreters and
programs
 Recognize program errors
 Become familiar with the program design process
 
 
 

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 2


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
In designing a program, there is no complete set of rules or specific
algorithm to follow. However, software developers try to use a reasonably
consistent problem solving approach for constructing computer programs.

1. Problem Definition (Analysis) PROBLEM


2. Algorithm Design SOLVING

3. Algorithm Implementation (Coding)


4. Program Testing IMPL EM EN TATIO N
5. Program Maintenance

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 3


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)

1 P RO B L E M D E F I N I T I O N ( A NA LYS I S )
 Problem definition is also called the analysis phase. The
problem is defined to obtain a clear understanding of the
problem requirement.
 The following questions should be asked to get a complete
problem specification:
a. What are the input data?
b. What are the output (desired) data?
c. What formula is to be used?
d. What other assumptions or constraints can be made?
e. What is the expected output screen?

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 4


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)

2 A LG O R I T H M D E S I G N
 The specifications derived earlier in the analysis phase are
translated into the algorithm.
 An algorithm is a step‐by‐step sequence of precise
instructions that must terminate and describes how the
data is to be processed to produce the desired outputs. The
instruction may be expressed in a human language.

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 5


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)

2 A LG O R I T H M D E S I G N
 An algorithm must satisfy some requirements:
a. Input and output
It must have zero or more input and must produce at least
one output.
b. Unambiguous
Every step in algorithm must be clear as to what it is
supposed to do and how many times it is expected to be
executed.
c. Correct and efficient
It must be correct and efficiently solve the problem for
it is designed.
d. Finite
It must execute its instruction and terminate in a finite
time.
CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 6
PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
An algorithm can be written or described using several tools:

2 ( i ) Ps e u d o co d e
 Use English‐like phrases to describe the processing
task. It is not standardized since every programmer has
his or her own way of planning the algorithm.

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 7


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
1 tools:
An algorithm can be written or described using several

2 Problem
Style 1

Problem
Style 2 (Modular design)

Begin Begin
Ps e u d o c o d e s t yl e

1. Subproblem 1 1. Subproblem 1
Task 1,1 2. Subproblem 2
Action 1,1,1 3. End
Action 1,1,2
2. Subproblem 2 1. Subproblem 1
Task 1,2 Task 1,1
Action 1,2,1 Action 1,1,1
Action 1,2,2 Action 1,1,2
End 2. Subproblem 2
Task 1,2
Action 1,2,1
Action 1,2,2
End

CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING 8


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
An algorithm can be written or described using several tools:

2 ( i i ) F l owc h a r t
 Use standardized symbol to show the steps the
computer needs to take to accomplish the
program’s objective.
 Because flowcharts are cumbersome to revise, they
have fallen out of favour by professional programmers.
Pseudocode, on the other hand, has gained increasing
acceptance.

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 9


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
An algorithm can be written or described using several tools:

2
F l owc h a r t Sy m b o l s

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 10


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
An algorithm can be written or described using several tools:

2 ( i i ) F l owc h a r t ( c o n t . )
 Most computer algorithms consist of at least the following
processes.
a. Get the input (data)
b. Perform the computation (processing)
c. Display the output (results)

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 11


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)

3 A LG O R I T H M I M P L E M E N TAT I O N ( CO D I N G )
 The algorithm is translated into a computer program by using a
specific programming language, for example C++. The process
called coding, which involves editing, compiling and debugging.

4 P RO G R A M T E ST I N G
 Program testing requires testing the completed program to verify
that it produces expected output. A different set of testing data
is normally used to verify that the program works properly and
that it is indeed solving the given problem.

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 12


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)

5 P RO G R A M M A I N T E NA N C E
 Often, there may be new requirements to be added into the
current program. Making revisions to meet the changing needs
with ongoing correction of problem are the major efforts in the
program maintenance.
 As a result, the program codes may be modified, added or
deleted accordingly. Thus, it is very important that a program is
well documented for future development.

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 13


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
EXAMPLE OF PROBLEM

 Write a complete C++ program to calculate the


sum and average of 2 integer numbers, and
then display the sum and the average of
those numbers.

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 14


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
EXAMPLE OF PROBLEM

ST E P 1 : P RO B L E M D E F I N I T I O N ( A NA LYS I S )

CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING 15


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
EXAMPLE OF PROBLEM
ST E P 2 : A LG O R I T H M D E S I G N ( Ps e u d o c o d e / F l owc h a r t )
( i ) Ps e u d o co d e

CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING 16


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
EXAMPLE OF PROBLEM
ST E P 2 : A LG O R I T H M D E S I G N ( Ps e u d o co d e / F l owc h a r t )
( i i ) F l owc h a r t

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 17


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
EXAMPLE OF PROBLEM
ST E P 2 : A LG O R I T H M D E S I G N ( Ps e u d o co d e / F l owc h a r t )
( i i ) F l owc h a r t

CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING 18


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
EXAMPLE OF PROBLEM
ST E P 3 : A LG O R I T H M I M P L E M E N TAT I O N ( CO D I N G )
Simple Sequential

CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING 19


PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
EXAMPLE OF PROBLEM
ST E P 3 : A LG O R I T H M I M P L E M E N TAT I O N ( CO D I N G )
Simple Modular

CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING 20


Simple Sequential

21
Simple Modular

22
Simple Sequential
Defence of Research Proposal (DRP) | 30th of
23
October 2014
Simple Modular

24
 Describe FIVE (5) steps of Program Development Life Cycle (PDLC).
 Define an algorithm.
 Define a flowchart.
 Define a pseudocode.

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 25


END OF CHAPTER 1

CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 26

You might also like