Hello all I have been given a strange requirement(challenging for me atleast) to write a logic in an application. I've to write a business logic wherein it should perform the following functionality
Total current consumption = current from A elements + current from B elements.
A and B are different types of devices
Now lets say the batteries required to supply the current (A+B) be 'X'
Also each X can contribute to the total current consumption, hence i need to calculate the total current consumption again just as first step including the battery current consumption
i.e
`Total current consumed : A + B + X"`
where X" is the current consumption of the battery
Now again i should calculate the batteries required. Let us say this as Y
i.e
to supply A + B + X" we need Y number of batteries.
Now check whether X == Y ?
If same, then return Y and exit
else add more X to the sum (A + B + X") till X == Y
Can anyone help me with initial set of pseudocode ? Any kind of suggestion is also deeply appreciated
Regards Learner
Yes the end result this logic should return is number of batteries required. However it should return this result only after computing the total current consumption recursively till X == Y, where
A : total current consumption of some active elements in a system.
B : total current consumption of some passive elements in a system
Total current consumption is A + B
to supply current of (A+B) amperes i require 'X' no. of batteries.
However each battery also adds some delta amount of current to the total value i.e
A + B + X"
if the batteries required to supply this delta is still 'X', then return X as the end result, else add more batteries --> calculate current --> no of batteries required ---> check again and so on ...