Try this:
weightValue = ((float)analogRead(5) / 1023); // convert to percentage of 100
weightRemainder = (1.0 - weightValue);
weightedAvg = weightValuequantityA + weightRemainderquantityB;
If you don't manually cast your analog read as a float, you are doing a division of one integer by another, which products an integer result. In your case, you'd be getting zero every time.
When you're doing a weighted average, you need your weights to all sum to 1. A way to check if your average makes sense is to consider what happens at three key weight values:
weightA = 0, weightB = 1 => result should be quantityB
weightA = 1, weightB = 0 => result should be quantityA
weightA = 1/2, weightB = 1/2 => result should be the standard average of A and B
- Ben