Академический Документы
Профессиональный Документы
Культура Документы
1.1.1 Term
c) A programming language
is set of instructions that can be used to
Program: construct a program. A notation for
A set of step-by-step instructions that directs a computer to
perform a specific task and to produce the required results. writing programs, which are specifications
of a computation or algorithm.
Programming:
Programming is a process of designing/ creating a program. is a language designed to describe a set of
consecutive actions to be executed by a
Programmer: computer. A programming language is
Programmer is a person who writes the program.
therefore a practical way for us (humans)
to give instructions to a computer.
1
2/17/2011
2
2/17/2011
3
2/17/2011
c. Object-Oriented Programming
b) Modular programming
Languages
is about relation between the data and the code
Programming paradigm based on data types. operating on the data (or data operating on the
An object stores a data type value; variable name code).
refers to object.
is a programming paradigm that uses "objects" –
A programming style that brakes down program
functions into modules, each of which accomplishes data structures consisting of data fields and
one function and contains all the source code and methods together with their interactions – to
variables needed to accomplish that function. design applications and computer programs.
Modular programming is a solution to the problem of Programming techniques may include features
very large programs that are difficult to debug and such as data abstraction, encapsulation,
maintain. By segmenting the program into modules modularity, polymorphism, and inheritance. Many
that perform clearly defined functions, you can
determine the source of program erros more easly. modern programming languages now support
OOP
4
2/17/2011
5
2/17/2011
Advantages of Modular
Modular Programming -
Programming
Process
Manageable: Reduce problem to smaller, simpler,
humanly comprehensible problems
Divisible: Modules can be assigned to different
teams/programmers
Enables parallel work, reducing program
development time
Facilitates programming, debugging, testing,
maintenance
Portable: Individual modules can be modified to
run on other platforms
• Re-usable: Modules can be re-used within a
program and acrossprograms
6
2/17/2011
Here the same functionality is repeated but does works (as can be seen in figure 1). However, the programmer can work more ef ficiently
by using modular programming. The output is the same as before (as can be seen in figure 2), but this time the chance of the operation of the script being altered due to a
typing error is greatly reduced, and if there is an error then the task of correcting it is made much simpler. The programmer can also
use the functionality throughout their application without worrying about having to rewrite the code, thereby improving the e fficiency
of both the code and their time.
7
2/17/2011
c) Object oriented
is as follows:
Variables can be objects, which have their
--- Program Start
object { own data and functions. Think like C and
var
var structures, except structures can have
function { ... }
function { ... } functions "in them" which operate
function { ... }
} specificly on their own data.
var
var
function { ... }
main { ... }
--- Program end
Example 1: Object-oriented
Problem Solving Approach
Step 1: Problem Identification - Compute Step 2: Object Identification
the sum of two numbers and print out - Identify objects needed to solve the
the result. problem.
Num1 - first number (object).
Num2 - second number (object).
Sum - result of the addition of the two
numbers (object).
8
2/17/2011
9
2/17/2011
10
2/17/2011
Contoh:Mengira harga
Is it sufficient for the
bayarbagi buku
implementation of the computer?
Example: Changing a bulb is burned (details)
Start
Place the ladder in the position of the bulb burns
Choose a suitable lamp
Take the stairs up to the light bulb that burns
Turn the bulb counterclockwise and take out the
bulb
Fit the new bulb in place proper
Turn the bulb clockwise
Down the stairs
Place the back stairs
End
11
2/17/2011
12
2/17/2011
13
2/17/2011
answers Problem 2
14
2/17/2011
a) Flowchart
Explanation of basic
flowchart symbol:
15
2/17/2011
Example Flowchart:
Flowchart to calculate the total of fine for late
returning of library books.
16
2/17/2011
b)Pseudocode
Steps in problem solving that is written half in
programming code and half in human language. Example:
17
2/17/2011
Problem 2
analysis of the problem:
1) input: A lecturer to determine the grade a
Number of cans of paint purchased, the student based on the marks obtained by
price of a can of paint students in the special examination. If you
2) The formula / process: score between 85 and 100, grade A if the
5 cans of paint price = price x number of student is not the student will receive a
cans grade of B. What grades will be earned by
3) output: the student if the score is 89?
prices for purchased 5 cans of paint
Problem:
1) input:
marks obtained A photostat shops charge 5 cents
2) The formula / process: for each page copied. Design
If you score 85-100, is a grade A solutions to calculate the fee should
If the contrary is a B grade imposed if a number of pages that have
3) Output: been
grade obtained diphotostat.
18
2/17/2011
Example 1:
Problem: To calculate the amount of water bill
Example 2:
Problem: To calculate area of a circle
Example : Calculate the Salary of
Employee
19
2/17/2011
d)Structure Charts
Structure chart is an additional method in
preparing programs that has many sub
modules.
It consists rectangular boxes, which
represents all the sub modules in a
program and is connected by arrows.
It illustrates the top-down design of a
program and is also known as hierarchical
chart because its components are in
hierarchical form.
The advantage is that it is easy to be drawn
and to be changed.
20