When every i try something new, I always 'throw myself in the deep end'. I'm in the initial stages of an android app build (my first android app, and first attempt at anything java)
I want to know if it is possible to search a database based on the entry's deviation from 3 or 4 required parameters.
For example, Say the database had a whole bunch of entries with 4 different numerical parameters - e.g
Entry1 - param1=100 param2=150 param3=75 param4=400
Entry2 - param1=150 param2=200 param3=100 param4=600
Entryn - param1=whatever....
And i require an entry as close as possible to -
Entry - param1=140 param2=190 param3=90 param4=580
I want to find the best result based on the average percentage deviation of these 4 parameters.
The maths I am currently using to get my number for average deviation is basically this -
dev = ((abs((parama1/paramx1)-1))+(abs((parama2/paramx2)-1))+(abs((parama3/paramx3)-1))+(abs((parama4/paramx4)-1))/4)
where parama is the required value and paramx is the database entry. (i don't know how to enter equations here, apologies for the messiness)
there could be a better way of doing this but it gives me the number i want so it will do for now.
Obviously entry2 is the best candidate in my example, with an average deviation of 0.0625 (6.25%) compared to 0.3292 (32.92%) for entry1.
Is this possible to do this in java? If so, what would be the best method?
At the moment i haven't started coding, all of this is just on paper.
Any advice would be much appreciated.