I need help with this assignment, i have somewhat started it but i'm completely lost. this is the assignment, any help would be greatly appreciated!
Create a 1-dimensional array with n elements; get the size of the array as user input (validate!), max size should be 10 (declared as class constant). Have functions to:
1. Take input from the user the elements of a 1-dimensional array.
2. Print a 1-dimensional array.
3. Compute the average value of this array.
4. Display all elements with even subscripts.
5. Display all elements with odd subscripts
6. Compute the sum of all elements with odd subscripts.
7. Compute the sum of all elements with even subscripts
Generate output similar, but not necessarily identical, to the sample output below.
SAMPLE RUN:
Do you want to start(Y/N): y
Enter array size: 7
Now enter 7 values:
56.7 78.9 23.5 111.5 114.7 99.99 88.88
The array elements are:
56.70 78.90 23.50 111.50 114.70 99.99 88.88
The average value = 82.02
The elements with even subscripts are:
Index Value
=============
0 56.70
2 23.50
4 114.70
The sum of the elements with odd subscripts = 290.39
Do you want to continue(Y/N): y
Enter array size: -4
ERROR! Should be positive and < 10. REENTER: 10
Now enter 10 values:
112 34.5 77.88 55.77 44.7 33.6 117.89 36.78 119.69 56.12
The array elements are:
112.00 34.50 77.88 55.77 44.70 33.60 117.89 36.78 119.69 56.12
The average value = 68.89
The elements with even subscripts are:
Index Value
=============
0 112.00
2 77.88
4 44.70
6 117.89
8 119.69
The sum of the elements with even subscripts = 472.16
The elements with odd subscripts are:
Index Value
=============
1 34.50
3 55.77
5 33.60
7 36.78
9 56.12
The sum of the elements with odd subscripts = 216.77
Do you want to continue(Y/N): n