hts.StevenWood.com

Exercise 4-2-3

Home ] Up ] InitArray.java ] InitArray1.java ] InitArray2.java ] SumArray.java ] SumArray1.java ] SumArray2.java ] Exercise 4-2-1 ] Exercise 4-2-2 ] [ Exercise 4-2-3 ] Labs ] Rubric ][ Last Page ]

Exercise 4-2-3

This is to be completed in class or for homework.

  1. Create an array named s to hold 75 whole number elements.
  2. Create your own user-defined methods to do each of the following:
    1. Fill the array with random numbers from -10 to 15 (-10 and 15 can be in the array.)
    2. Count and display the number of 0s in the array.
    3. Find the average of the numbers in s. Display it from the main method.
    4. Display the indexes [subscript] of the cells that contain even numbers.
    5. Display the indexes [subscript] of the cells that contain odd numbers.
    6. Count and display the number of 7s in the array.
      • Also display the subscript [index] numbers of 'boxes' that contains a value of 7.
    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.        

 

Home ] Up ] InitArray.java ] InitArray1.java ] InitArray2.java ] SumArray.java ] SumArray1.java ] SumArray2.java ] Exercise 4-2-1 ] Exercise 4-2-2 ] [ Exercise 4-2-3 ] Labs ] Rubric ][Last Page]
All material on this site is copyright © 1997- by Steven Wood or as credited. All right reserved. Use of this site indicates you agreement with the  terms of use.
Send comments or questions to about this page.
Every attempt has been made to credit work under copyright. If there are any claims that copyright has been missed please contact the .
+SDG+