Introduction To Programming Information Technology , 1’st

Download Report

Transcript Introduction To Programming Information Technology , 1’st

MINISTRY OF EDUCATION & HIGHER EDUCATION
COLLEGE OF SCIENCE AND TECHNOLOGY
KHANYOUNIS- PALESTINE
Using Java
Lecture 14
Arrays
Practices
Practice 1

Find and correct the error in each of the
following program segments:
Presented & Prepared by: Mahmoud R. Alfarra
2
Practice 2

a.
b.
c.
d.
e.
Write Java statements to accomplish each of the following
tasks:
Display the value of the seventh element of character array f.
Initialize each of the five elements of one-dimensional
integer array g to 8.
Total the 100 elements of floating-point array c.
Copy 11-element array a into the first portion of array b,
which contains 34 elements.
Determine and display the smallest and largest values
contained in 99-element floating-point array w.
Presented & Prepared by: Mahmoud R. Alfarra
3
Practice 3: Duplicate Elimination

Use a one-dimensional array to solve the following
problem: Write an application that inputs five
numbers, each of which is between 10 and 100,
inclusive. As each number is read, display it only if it
is not a duplicate of a number already read. Provide
for the "worst case," in which all five numbers are
different. Use the smallest possible array to solve
this problem. Display the complete set of unique
values input after the user inputs each new value.
Presented & Prepared by: Mahmoud R. Alfarra
4
More Practices
 More
practices in
the text book,
chapters 7
Presented & Prepared by: Mahmoud R. Alfarra
5
‫بسم اهلل ‪...‬‬
‫و يرد السـالم‬
‫كان النبي صلى اهلل عليه وسلم إذا دخل بيته يقول‪:‬‬
‫‪6‬‬
‫‪Presented & Prepared by: Mahmoud R. Alfarra‬‬
Methods
in Java
Presented & Prepared by: Mahmoud R. Alfarra
7