+1(805) 568 7317

java array and loop question there are two arrays one holds time and one holds amoun 5124148

JAVA Array and Loop Question. There are two arrays, one holds time and one holds amount, eachcorresponding to each other. arrA= [ 0, 2, 3, 0, 2] arrB = [500, 100, 400, 650, 50] From these I must find the maximum sum of array B withcorrespondence of arrA being the urgency #. So for example from the arrays above: from arrA there are two0s. I must pick the one with the highest amount, in this case 650.Then the next is there are two 2s, and pick the max amount which is100, and 3 is just one. From this my max sum should be 1150. Whatwould be the loop behind this algorithm, tried to do it but gotvery confused. EXTRA: with each loop iteration, arrA elements must decrease by1. so for i =1, arrA = [ 0, 1, 2, 1, 0], if i=2 arrA = [0, 0, 1, 0,0], etc… It would be nice if you could help me with this but just showingthe above one is fine too. Thank you, will give thumbs up forcorrect code. . . .

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon

Order Now