(Cmax - Acurrent) = MaxFill
If Bincome > MaxFill
. .... then NewAcurrent = Acurrent - MaxFill
& NewBincome = Bincome - MaxFill
If Bincome <= MaxFill
. ... then NewAcurrent = Acurrent - Bincome & NewBincome = zero
Or getting MaxFill out there again (it explained well with)
If Bincome > (Cmax - Acurrent)
. .... then NewAcurrent = Acurrent - (Cmax - Acurrent)
& NewBincome = Bincome - (Cmax - Acurrent)
If Bincome <= (Cmax - Acurrent)
. ... then NewAcurrent = Acurrent - Bincome
& NewBincome = zero
Under the assumption that Bincome cant be negative.