Create your own assignment to get more practice with arrays


Create your own assignment to get more practice with arrays. Listed below are twenty seven functions you can write that deal with arrays. Listed next to each function is a number of points each is worth in parenthesis. You must choose enough functions to add up to 15 points! You can choose to do more, but you will only get up to 15 points for this assignment.

For each of the following:

-You must create a function that carries out the desired action. Please keep in mind that printing should not be done in your functions!

-You should provide enough code in main to test each of your functions. You may use prepopulated arrays in main to pass into each of your functions, and you can print them out in main (or write an array printing function!)

Anyone who successfully completes and demonstrates ALL 27 functions will receive 15 extra credit points on this assignment (30/15).

1) Subtract two arrays, store the result in a third array.

2) Multiply two arrays, store the result in a third array.

3) Divide two arrays, store the result in a third array.

4) Add two 2D arrays, store the result in a third 2D array.

5) Subtract two 2D arrays, store the result in a third 2D array.

6) Multiply two 2D arrays, store the result in a third 2D array.

7) Divide two 2D arrays, store the result in a third array.

8) Average all the elements in an array.

9) Average all the elements in a 2D array.

10) Reverse the values in an array.

11) Transpose a 2D array. (Rows become columns, columns become rows)

12) Compress an array by averaging pairs of elements. For example, compressing array [1, 3, 8, 7, 5] produces array [2, 7.5, 5]

13) Produce the sum of the elements on the main diagonal of a square array.

14) Produce the product of the elements on the main diagonal of a square array.

15) Find the minimum element in a 2D array.

16) Find the maximum element in a 2D array.

17) Shift an array left or right by a number of positions. Elements shifted out are lost. Elements shifted in are zeros. For example, given array [2, 4, 6, 8, 9] shifted right by 2 produces array [0, 0, 2, 4, 6]. Shifting the original array left 1 produces array [4, 6, 8, 9, 0].

18) A 2D array exhibits Row Magic (every row has the same sum) (Return 1 or 0 for yes or no)

19) A 2D array exhibits Column Magic (every column has the same sum) (Return 1 or 0 for yes or no)

20) Insert an element in an array at a given position, and shift elements down. The last element will 'fall off' the array. For example, given array [3, 4, 6, 7, 8] Insert 1 at index 2 results in array [3, 4, 1, 6, 7].

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Create your own assignment to get more practice with arrays
Reference No:- TGS01041990

Expected delivery within 24 Hours