15/03/2022
Assignments on Array Programming[Part-1]
===========================================
You must develop below program by using both tradition approach by using for loop and by using Java 8v Stream API approach
===========================================
1. Develop a program to create an array of integers, display all values on console with their position
starts with 1. Support if an array has values 3, 4, 5, 6, 7 you must display values as
Value 1: 3
Value 2: 4
Value 3: 5
Value 4: 6
Value 5: 7
2. Develop a program to create an array of integers, display only even indexes elements
Support if an array has values 3, 4, 5, 6, 7 you must display values "even index" values 3 5 7
0 1 2 3 4
3. Develop a program to create an array of integers, display only even elements
Support if an array has values 3, 4, 5, 6, 7 you must display values "even elements" 4 6
0 1 2 3 4
4. Develop a program to create an array of integers, display only the elements divisible by 3
Support if an array has values 3, 4, 5, 6, 7 you must display values "/ 3 " 3, 6
0 1 2 3 4
5. Develop a program to create an array of integers, search for the element 2,
if available display "the value 2 is available"
if no available display "the value 2 is not available"
Support if an array has values 3, 4, 5, 6, 7 you must display
O/P: the value 2 is not available
Support if an array has values 3, 4, 5, 2, 6 you must display
O/P: the value 2 is available
6. Develop a program to create an array of integers, search for the element 2,
if available display "the value 2 is available"
if no available display "the value 2 is not available"
Support if an array has values 3, 4, 5, 2, 6 you must display
O/P: the value 2 is available
Support if an array has values 3, 4, 5, 6, 7 you must display
O/P: the value 2 is not available
7. Develop a program to create an array of integers, search for the element 2,
if available display "its index number" to tell that value 2 is present in array at so and so location
if not available display "-1" to tell that value 2 is not present in array
Support if an array has values 3, 4, 5, 2, 6 you must display
O/P: 3
Support if an array has values 3, 4, 5, 6, 7 you must display
O/P: -1
7. Develop a program to create an array of integers, REMOVE the element 2, FROM THE ARRAY
Support if an array has values 3, 4, 5, 2, 6 after remove 2 array must be
O/P: [3, 4, 5, 2, 6]
O/P: [3, 4, 5, 6]
8. Develop a program to create an array of integers, INSERT the element 2 in this ARRAY at 3rd index
Support if an array has values 3, 4, 5, 6 after inserting 2 array must be
O/P: [3, 4, 5, 6]
O/P: [3, 4, 5, 2, 6]
9. Develop a program to create an array of integers, REPALCE the element 2 with 9
Support if an array has values 3, 4, 5, 2, 6 after replacing 2 array must be
O/P: [3, 4, 5, 2, 6]
O/P: [3, 4, 5, 9, 6]
10. Develop a program to create an array of integers, SORT the elements in array in Ascending order
Support if an array has values 3, 4, 5, 2, 6 after sorting array must
O/P: [3, 4, 5, 2, 6]
O/P: [2, 3, 4, 5, 6]