1. Using Java
MINISTRY OF EDUCATION & HIGHER EDUCATION
COLLEGE OF SCIENCE AND TECHNOLOGY
KHANYOUNIS- PALESTINE
2. 2Presented & Prepared by: Mahmoud R. Alfarra
Home WorkHW 1.1
Be Care
Very Important information
3. Programming Life Cycle …
Algorithms
Pseudo Code
Flow Chart
Practices
Emank X Mezank
3Presented & Prepared by: Mahmoud R. Alfarra
4. Building an application has five sorted stages:
Thinking
Planning
Designing
Coding
Testing
4Presented & Prepared by: Mahmoud R. Alfarra
5. Thinking Stage is the most important one in
the life cycle of programming because its
result has an occur affect on the following
stages.
No rules
No specific language
Only read, understand, imagine
5Presented & Prepared by: Mahmoud R. Alfarra
6. Before writing a program to solve a problem,
it is essential to have a thorough
understanding of the problem and a carefully
planned approach to solving it.
We have many techniques to represent our
approach before designing and coding
it(Algorithm).
Pseudo Code
Flow Chart
6Presented & Prepared by: Mahmoud R. Alfarra
7. Designing stage focuses on how the
application will be appeared to users.
7Presented & Prepared by: Mahmoud R. Alfarra
8. In this stage, we translate all of the previous
stages to a specific programming language.
8Presented & Prepared by: Mahmoud R. Alfarra
X<=0
yes
F(x)= XF(x)= - X
NO
If (x>=0)
Fx = x;
else
Fx = -x;
9. InThis stage, the programmer test his
application by inputting many values and
compare the results with the supposed one.
If they are not the same … the programmer
must repair his application.
9Presented & Prepared by: Mahmoud R. Alfarra
10. Any computing problem can be solved by
executing a series of actions in a specific
order.
An algorithm is a procedure for solving a
problem in terms of
The actions to execute and
The order in which these actions execute.
10Presented & Prepared by: Mahmoud R. Alfarra
In two pages, write what is algorithm, why and how
do they represented ?HW 2.1
11. Specifying the order in which statements
(actions) execute in a program is called
program control.
Program control can be one of three
structures :
Sequential structure
Selection structure
Repetition structure
11Presented & Prepared by: Mahmoud R. Alfarra
12. Documented my solution ideas
Detect the time and space of the solution.
Help the programmer to determine the
logical errors.
Comparing between solutions of the same
problem.
12Presented & Prepared by: Mahmoud R. Alfarra
13. To represent algorithms we have two ways:
13Presented & Prepared by: Mahmoud R. Alfarra
Algorithms
representation
Pseudo code Flow Chart
14. Pseudocode is an informal language that
helps programmers develop algorithms
without having to worry about the strict
details of Programming language syntax.
Pseudocode is similar to everyday English.
But it is not an actual computer programming
language.
14Presented & Prepared by: Mahmoud R. Alfarra
15. Pseudocode normally describes only statements
representing the actions of the solution.
Such actions might include input, output or a
calculation.
15Presented & Prepared by: Mahmoud R. Alfarra
If student's grade is greater than or equal to 60
Print "passed"
else
Print "failed"
16. Flow Chart is a way to illustrate the step of
solving the problems using shapes.
Every pseudo code can be represented by
Flow chart.
16Presented & Prepared by: Mahmoud R. Alfarra
In one page, discuss the meaning of Flowchart
and its importance?HW 2.2
17. 17Presented & Prepared by: Mahmoud R. Alfarra
To represent the start and
end of the program
To represent the input and
Output process
To represent the arithmetic
operations
18. 18Presented & Prepared by: Mahmoud R. Alfarra
To represent logical operators
And conditions as (if (x >5))
To represent the flow of
the operations
20. Write the algorithm to print the average of
the temperaturesT1,T2,T3.
20Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.1
Read theT1,T2,T3
Calculate the sum by: sum =T1,T2,T3
Calculate the average by : average = sum/3
Print average
Be Care: when the question ask about an algorithm, you can
write pseudo code or Flow chart, its yours
21. 21Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.1
Sum = T1+T2+T3
Start
Read
T1, T2, T3
Average = sum/3
Print
Average
End
This control structure is a
Sequential Structure.
That the statements in a
program are executed
one after the other in the
order in which they are
written.
22. Write the algorithm to calculate the average
of the temperaturesT1,T2,T3 and print
(cold)if it less than 17 and print (hot) if it
greater or equal to 17.
22Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.2
Be Care: When the question ask about a specific
representation way, you MUST solve with this way.
23. 23Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.2
Sum = T1+T2+T3
Start
Read
T1, T2, T3
Avg = sum/3
Print Hot
Avg >= 17
Print Cold
End
YesNo
This control
structure is a
selection structure
That the statements
in a program are
executed one after
the other in the
order in which they
are written.
24. Write an algorithm to Print the area of a
circle,( area = π * R2 ).
24Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.3
Read the R
Set π = 3.14
Calculate the area by: area = π * R *R
Print area
Arithmetic equation In algorithms, must be simplified (i.e: X2=
X*X) , (2X = 2*X), (2+3X = 2+ 3*x) etc.
25. 25Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.3
π = 3.14
start
Read R
area = π × R ×R
Print area
End
Rewrite this practice,
to calculate the
around of circle and
Print (Max) if it is
greater than 40 and
print (Min) if it is less
than or equal to 40
HW 2.3
26. Write an algorithm to accept an integer from
the user and then print it multiple table from
(1 to 12)…
26Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.4
Read the X
Set counter to 1
While counter less than or equal to 12 Repeat
Print X * counter
Set counter = counter +1
27. 27Presented & Prepared by: Mahmoud R. Alfarra
Counter = 1
Start
Read
X
Print (counter *X)
Counter <=12
End
No
Counter = counter +1
Yes
Practice 1.4
28. 1. Write an algorithm to calculate the value of
the F(x) function.
2. Write an algorithm to accept three integers
from the users and print the maximum one.
3. Write an algorithm to print the average of
population of Gaza.
28Presented & Prepared by: Mahmoud R. Alfarra
0
0
x x
F(x)
x x
29. 4. Write an algorithm to calculate how many
IT student success in the Programming 1
course.
29Presented & Prepared by: Mahmoud R. Alfarra
Consider all of the previous practices as home
workHW 2.4