I have most the parts to this code working but need some guidance for two last calculations or at least one and i can figure the other one out.
I'm trying to find the average value for both:
1 2 3 4
double calculateAverageHarvest(int harvest[ ])
//calculate the average daily harvest after 30 days
double calculateAverageSales(int sales[ ])
//calculate the average apple sales after 30 days
I have what i think should lead me to the answer below but I could be completely wrong. Please help, thanks!
In order to check that your function works correctly we call
your function in the following way:
We choose 30 random values (integers) between 5-43
We then pass that array to your function and check if the
result is as expected
Here are the results of your function, with the correct (expected)
results, first we print all 30 values that are in the array then
we print the correct answer and your answer, on the same line
28
20
20
20
36
33
19
16
40
7
7
33
15
40
25
21
6
25
24
38
40
5
15
22
24
14
33
15
35
12
22.9333 28
Is my error because I have an int and a double? I noticed the answer they are looking for is in float form to the 4 decimal places "22.9333" and my answer is coming out as an int "28"...
I'm still doing something wrong. I updated the code above to what I'm running and the figures are still pretty off. I changed everything over to a double.