BASIC PROG - MIDTERMS
BASIC PROG - MIDTERMS
whole
Basic Programming
● White box testing - Testing the program by
Lesson 1: Introduction assuming everything about the program,
making sure that every instruction and every
possible situation has been tested.
Programming - It is a process which involves planning,
scheduling or performing a task or an event.
5. Documentation - When the program is finished
Computer Programming - It is the process of writing and thoroughly tested, the documentation on
instructions to perform specific actions in a computer, the program is included for its distribution. It
and instructs the machine on how to perform in order usually includes necessary information about
to solve problems. the requirements of the program - operating
system and hardware requirements needed for
Data Processing Cycle - is a set of steps the computer the program to run.
follows to receive data, process the data according to
instructions from a program, display the resulting 6. Maintenance - Maintaining or updating the
information to the user, and store the results program, keeping the program running
(Information Processing Cycle) smoothly and updated with the developments
and changes in the field where it is used.
Program Development Process
UP, DS, I, T, D, M Programming Language - is a vocabulary and set of
1. Understanding the Problem - The first step is grammatical rules for instructing a computer or
to get a clear idea of what you want to do. You computing device to perform specific tasks.
need to know what kind of input to expect, how
the input is to be processed, and what kind of Syntax - set of grammatical rules for writing any
output is required. statement in a programming language
Algorithm/Pseudocode
Sequential
Steps are performed in strictly sequential manner, each
step being executed exactly once.
Selection/Conditional
The execution of instructions by selection, wherein
conditions for a series of alternative statements are
evaluated to specify which instruction is to be
executed.
- The flow of the program depends on the set of
conditions that are written
- Condition or conditional expression is in the
form of a mathematical statement using
equals, less-than, or greater-than
Condition-controlled loop
A condition-controlled loop is used when is not known
how many times iteration will need to occur
Count-controlled loop
The way the count-controlled loop works is simple: the
loop holds a count of the number of times it runs, and
the loop stops when the count reaches the specified
count.
Modular/Procedural
Initialization: The control variable (counter) is The approach is sometimes called divide and conquer
initialized to the starting value before the loop starts. because a large task is divided into several smaller
tasks that are easily performed
Test: the loop terminating condition that checks if
looping should continue
Identifiers
Identifiers are the technical terms for a name in a
programming language. It includes name of a variable,
name of a class, a method or an object.
Use a text editor to create a program, this program is
called the source program. The program must be saved Rules for identifiers are:
in a file named ‹ClassName> java, where ClassName is •The only valid name symbols are the capital letters
the name of the Java class contained in the file. A through Z, the lowercase letters a through z.
•the digits 0 through 9, and the underscore.
An integrated development environment (IDE) is a • The first character of the identifier cannot be a digit
programming environment that has been packaged as or an underscore.
an application program, typically consisting of a code
editor, a compiler, a debugger, and a graphical user
Valid Identifiers Invalid Identifiers
interface (GUI) builder. The IDE may be a standalone
application or may be included as part of one or more grade grade + 3
existing and compatible applications
area 1 1 area
You use the command javac(the Java compiler) to
area_of_triangle area of triangle
compile a program. For example, you'd type
Arithmetic Operators
+= -= *= /= %=
Ex: y = y + 5 — y+=5
Arithmetic Operators