2

I have multiple arrays, which looks like this

1st array of object looks like this

Array[4]

    0 : Object
        price:"2"       
        ref:"A"
    1 : Object
        price:"20"
        ref:"B"
    2 : Object
        price:"23"      
        ref:"C"
    3 : Object
        price:"23"      
        ref:"D"     

2nd array of objects looks like this

Array[4]

    0 : Object
        price:"12"      
        ref:"A"
    1 : Object
        price:"5"       
        ref:"B"
    2 : Object
        price:"23"      
        ref:"E"
    3 : Object
        price:"23"      
        ref:"F" 

And my third object looks like this.

Array[2]

0 : Object
    name:"Blah"     
    fcp:"erol"
1 : Object
    name:"Blah2"        
    fcp:"tpep"

Now i want to sum the price based on ref. 1st object and 2nd object has ref A and B common. So that the final object looks like

Array[7]

    0 : Object
        price:"14"      
        ref:"A"
    1 : Object
        price:"25"
        ref:"B"
    2 : Object
        price:"23"      
        ref:"C"
    3 : Object
        price:"23"      
        ref:"D" 
    4 : Object
        price:"23"      
        ref:"E"
    5 : Object
        price:"23"      
        ref:"F" 
    6 : Object
        name:"Blah"     
        fcp:"erol"
    7 : Object
        name:"Blah2"        
        fcp:"tpep"