310 likes | 334 Views
MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE. Using Java. Introduction To Programming Information Technology , 1’ st Semester. Lecture 2 : How To Build applications?. Teacher: Mahmoud Rafeek Alfarra. Notations. HW 1.1. Home Work.
E N D
MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE Using Java Introduction To ProgrammingInformation Technology , 1’st Semester Lecture 2 : How To Build applications? Teacher: Mahmoud Rafeek Alfarra
Notations HW 1.1 Home Work Be Care Very Important information Presented & Prepared by: Mahmoud R. Alfarra
Outline • Programming Life Cycle … • Algorithms • Pseudo Code • Flow Chart • Practices • Emank X Mezank Presented & Prepared by: Mahmoud R. Alfarra
Programming Life Cycle • Building an application has five sorted stages: • Thinking • Planning • Designing • Coding • Testing Presented & Prepared by: Mahmoud R. Alfarra
Thinking Stage • 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 Presented & Prepared by: Mahmoud R. Alfarra
Planning Stage • 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 Presented & Prepared by: Mahmoud R. Alfarra
Designing Stage • Designing stage focuses on how the application will be appeared to users. Presented & Prepared by: Mahmoud R. Alfarra
Coding stage • In this stage, we translate all of the previous stages to a specific programming language. NO yes If (x>=0) Fx = x; else Fx = -x; X <=0 F(x) =- X F(x) = X Presented & Prepared by: Mahmoud R. Alfarra
Testing stage • In This 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. Presented & Prepared by: Mahmoud R. Alfarra
What are the algorithms? • 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. HW 2.1 In two pages, write what is algorithm, why and how do they represented ? Presented & Prepared by: Mahmoud R. Alfarra
What are Algorithms? • 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 Presented & Prepared by: Mahmoud R. Alfarra
Why Algorithms? • 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. Presented & Prepared by: Mahmoud R. Alfarra
How to represent Algorithms? • To represent algorithms we have two ways: Algorithms representation Pseudo code Flow Chart Presented & Prepared by: Mahmoud R. Alfarra
Pseudo code • 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. Presented & Prepared by: Mahmoud R. Alfarra
Pseudo code • Pseudocode normally describes only statements representing the actions of the solution. • Such actions might include input, output or a calculation. If student's grade is greater than or equal to 60 Print "passed" else Print "failed" Presented & Prepared by: Mahmoud R. Alfarra
Flow Chart • Flow Chart is a way to illustrate the step of solving the problems using shapes. • Every pseudo code can be represented by Flow chart. HW 2.2 In one page, discuss the meaning of Flowchart and its importance? Presented & Prepared by: Mahmoud R. Alfarra
Flow Chart Shapes To represent the start and end of the program To represent the input and Output process To represent the arithmetic operations Presented & Prepared by: Mahmoud R. Alfarra
Flow Chart Shapes To represent logical operators And conditions as (if (x >5)) To represent the flow of the operations Presented & Prepared by: Mahmoud R. Alfarra
Think & Solve Practices Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.1 Write Algorithm… • Write the algorithm to print the average of the temperatures T1, T2, T3. Read the T1, 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 Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.1 Write Algorithm… Start Read T1, T2, T3 • 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. Sum = T1+T2+T3 Average = sum/3 Print Average End Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.2 Write Flow chart… • Write the algorithm to calculate the average of the temperatures T1, T2, T3 and print (cold)if it less than 17 and print (hot) if it greater or equal to 17. Be Care: When the question ask about a specific representation way, you MUSTsolve with this way. Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.2 Write Flow chart… Start Read T1, T2, T3 • 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. Sum = T1+T2+T3 Avg = sum/3 No Yes Avg >= 17 Print Cold Print Hot End Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.3 Write Algorithm… • Write an algorithm to Print the area of a circle,( area = π * R2 ). 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. Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.3 Write Algorithm… start Read R π = 3.14 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 area = π × R × R Print area HW 2.3 End Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.4 Write Algorithm… • Write an algorithm to accept an integer from the user and then print it multiple table from (1 to 12)… Read the X Set counter to 1 While counter less than or equal to 12 Repeat Print X * counter Set counter = counter +1 Presented & Prepared by: Mahmoud R. Alfarra
Practice 1.4 Write Algorithm… Start Read X Counter = 1 No Counter <=12 Yes Print (counter *X) Counter = counter +1 Presented & Prepared by: Mahmoud R. Alfarra End
Now … Try the Following • Write an algorithm to calculate the value of the F(x) function. • Write an algorithm to accept three integers from the users and print the maximum one. • Write an algorithm to print the average of population of Gaza. Presented & Prepared by: Mahmoud R. Alfarra
Now … Try the Following • Write an algorithm to calculate how many IT student success in the Programming 1 course. Consider all of the previous practices as home work HW 2.4 Presented & Prepared by: Mahmoud R. Alfarra
Emank X Mezank عَنْ أَبِي أُمَامَةَ رَضِيَ الله عَنْهُ، عَنْ رَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ، قَالَ : (إِنَّ صَاحِبَ الشِّمَالِ لِيَرْفَعُ الْقَلَمَ سِتَّ سَاعَاتٍ عَنِ الْعَبْدِ الْمُسْلِمِ الْمُخْطِئِ أَوِ الْمُسِيءِ، فَإِنْ نَدِمَ وَاسْتَغْفَرَ اللَّهَ مِنْهَا أَلْقَاهَا، وَإِلا كُتِبَتْ وَاحِدَةً) حسنـه الألباني Presented & Prepared by: Mahmoud R. Alfarra
Next… Main concepts of Programming Presented & Prepared by: Mahmoud R. Alfarra