I need to be able to edit weights values which are integers types by percentages.
For example: I got the following weights:
Var Weight x 100 y 50 z 50 So z is 25% ,y is 25% and x is 50%
Now if I want to be able to edit an existing weight or to add new weight by percentage input, how can I make sure that the weights will still be integers types and that I won't have any rounding needed.
For example, if I want to add a new weight which will be 25% from the total weights, how can I calculate this? Notice that I can change the other weights (increment/decrement) in order to achieve this.
But the necessary condition here that need to take place is that the weights will stay integers and the percentage of the new/edits weights will be as requested.
If I didn't have to make sure that the weights will be integers then it was easy, I can just use the following equation:
NewWeight = (Sum*RequestedPerecentage)/(1-RequestedPerecentage)
but that's not the case...