|
| |
Exercise 4-2-3
This is to be completed in class or for homework.
- Create an array named s to hold 75 whole number elements.
- Create your own user-defined methods to do each of the following:
- Fill the array with random numbers from -10 to 15 (-10 and 15 can be
in the array.)
- Count and display the number of 0s in the array.
- Find the average of the numbers in s. Display it from the main
method.
- Display the indexes [subscript] of the cells that contain even numbers.
- Display the indexes [subscript] of the cells that contain odd numbers.
- Count and display the number of 7s in the array.
- Also display the subscript [index] numbers of 'boxes' that contains a value of 7.
- Print the entire array in five columns (just the contents, not the
subscripts).
E.g.
| -4 |
5 |
10 |
-9 |
7 |
| 5 |
1 |
1 |
0 |
3 |
| etc. |
|
|
|
|
|