Академический Документы
Профессиональный Документы
Культура Документы
Java, another programming language, considered as the most popular is also a general-
purpose language, which is very good in the area of client-server web applications and mobile
applications.
Formulating the problem involves clearly defining the problem in terms of its input and output
requirements. Every computing problem always has inputs, the computation applied to
manipulate the input to come up with the desired output.
The creative solution in programming is called algorithm which is usually presented initially
as flowchart or pseudo-code. An algorithm is a general process for solving a specific computing
problem – a step by step solution to a problem.
Expressing the solution in a clear and accurate manner is done through the use of formal
notation or programming language. Writing solutions in a specific programming language
requires knowledge of that language: its syntax and semantics.
There are hundreds of programming languages available to write application programs. These
programming languages can be classified into two: Low-level languages and high-level
languages.
1. Low-level languages are those computer programs written in the native language of the
computer which can be directly executed by the processor.
a. Machine-level language (Machine Code) – the lowest level of programming
languages which can be directly executed by the computer’s processor without
undergoing translation. It is written entirely in numbers.
b. Assembly language – the next level of programming language but still considered
as low-level. It uses mnemonics or English words to represent each machine code.
The assembly code has to be translated to machine code prior to the processor’s
execution.
1. Interpreters processes programs one line at a time, alternately reading lines and
performing computations.
2. Compilers processes programs by translating the entire program first before executing
the code and performing computations. As a result of translating the entire program, a
file called the object code is created containing the machine-level codes.
INPUT
PROCESS
OUTPUT
All of the problem you will encounter in this course follow this basic algorithm. Which means
that there has to be inputs whether from keyboard, from a file or embedded data; followed by
a set of process or operation which could be mathematical or symbolic; and lastly is the output,
which shows results of the operation.
Flowcharts are used by programmers before the actual start of any programming activity.
Flowchart is otherwise known as Data Flow Diagram.
Advantages of Flowchart
1. The flow of the program is easily understood.
2. It determines the validity of the processes involved in the program.
3. Debugging or correcting of errors becomes less complicated.
4. It produces effective program documentation.
Guidelines for preparing a Flowchart
Compute the area of a circle Input 3 numbers and display their product Compute the perimeter of a rectangle
Begin
Begin
𝜋 = 3.1416
radius = 5
𝐴𝑟𝑒𝑎 = 𝜋𝑟 2
Display area of
the circle
End
Data types in Python
Programming languages manipulate data which differ in form. Python recognizes the
following types of data: integers, floating-point values and strings.
To determine the type of a specific data, Python has a built-in function called type(). The
argument it takes is the value. For example, in the Python Interactive mode the following
screen output shows how the function type() is used:
Arithmetic operators
Arithmetic operators are used to perform mathematical operations like addition, subtraction,
multiplication etc.
Symbol Operation Example
+ Addition 5+7
- Subtraction 24 – 14
* Multiplication 11 * 9
/ Division 13/5
% Remainder (modulo) 17 % 6
// Integer Division 14 // 3
** (Power) Exponentiation 2 ** 5
When multiple operations are involve in a problem, the order of operators will be as follows:
1st: Parenthesis ()
2nd: Exponentiation **
3rd: Multiplication *
4th: Division /
5th: Integer Division //
6th: Modulo %
7th: Addition +
8th: Subtraction -