アプリケーションにロジックを記述する必要があります (少なくとも私にとっては挑戦的です)。次の機能を実行するビジネスロジックを作成する必要があります
Total current consumption = current from A elements + current from B elements.
A and B are different types of devices
ここで、電流(A+B)を供給するのに必要な電池を「X」としましょう。
また、各 X は総消費電流に寄与する可能性があるため、バッテリーの消費電流を含む最初のステップと同じように、総消費電流を再度計算する必要があります。
すなわち
`Total current consumed : A + B + X"`
where X" is the current consumption of the battery
もう一度、必要なバッテリーを計算する必要があります。これをYとしましょう
すなわち
A + B + X" を供給するには、Y 個のバッテリーが必要です。
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
疑似コードの初期セットを手伝ってくれる人はいますか? どんな種類の提案も大歓迎です
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 ...