Introduction to
Programming
Dr. Mohamad Obaid
Deference between Algorithm and
Program
Algorithm:
• many steps
• written in natural languages or charts
• understanding from human
Program:
• many instructions
• written using a Program Language
• understanding from computers, or another programmer.
Some Programing languages
Year Language
1958 Fortran
1960 Cobol
1972 C
1983 C++
1991 Visual Basic
1991 Python
1995 Delphi
1995 Java
2001 C#
2011 Kotlin
Algorithms Description
• natural languages ( English , Arabic , … etc. )
• pseudo code
• flow charts
• etc.
Example: solving 2degree equation
+bx+c=0 solution
step1: input argument a , b, c
step2: calculate - 4ac
step3: a)
b)
c)
step4: print results
Flow Chart shapes
Meaning Shape
beginning of flow chart
start
ending of flow chart
stop
input data
Read
output data
Write
data processing
decision yes or no
condition
large flow chart
many pagesnum
Flow Chart to calculate
the area and perimeter of rectangle
Flow Chart to calculate
the area and perimeter of Circle
Flow Chart to calculate
the Max between two numbers
Flow Chart to Compare three numbers
Flow Chart to Compare three numbers
Flow Chart to solve 2’d degree equation
Flow Char to print hi word five times then print hello
Flow Char to print the integer numbers form 1 to 10
Flow Char to print the odd integer numbers form 1 to 10
Characteristics of Java
• simple
• object-oriented
• distributed
• interpreted
• secure
• portable
• multithreaded
Creating and Compiling Programs
Create/Modify Source Code
Source Code
Compile Source Code
i.e. javac Welcome.java
If compilation errors
Bytecode
Run Byteode
i.e. java Welcome
Result
If runtime errors or incorrect result
Application Executing
Bytecode
Java Java Java
Interpreter Interpreter Interpreter
...
on Windows on Linux on Sun Solaris
Java Application
• Desktop Application
• Web Application
• Mobile Application
Some Expressions
• SDK (Software Development Kit)
• JDK (Java Development Kit)
• IDE (Integrated Development Environment)
• JVM (Java Virtual Machine)
• Java SE (Java Standard Edition)
• Java EE (Java Enterprise Edition)
• Java ME (Java Micro Edition)
• JRE (Java Runtime Environment)
• API (Application Programing Interface)