I’m wanting to find the average difference of the array totals.
My array structures are as follows (pulled from a database):
day, 1, 2, 3, 4
So you can see the 5 arrays how it’s pulled from the database.
Now for instance, the Java algorithm I need is as follows:
To add each of the 1,2,3,4 values up, then loop to the next day (if there is one), repeating the same addition. Then eventually, calculate the ‘average difference’ between the totals of each day.
So for example, i’ve done some sample data to try and make it clearer for you!
1 (Mon) 135 90 105 150
2 (Tues) 143 86 117 163
3 (Wed) 129 100 140 158
So what the algorithm needs to do is:
135+90+105+150 = 500,
143+86+117+163 = 509,
129+100+140+158 = 527
But the only problem, is that, column 1 is its own array and column 2,3,4 preceding.
Calculate the ‘average increase/decrease’ which would be:
I’m unsure how to implement it into Java! Any help would be appreciated.
If i can provide any more information please let me know.
Many thanks.
Since we know the location of the items in the database, the following might work:
I hope this helps. Help with Average Percent Change