Már kapott egy követelmény (kihívást számomra legalábbis), hogy írjon egy logikai egy alkalmazásban. Nekem, hogy írjon egy üzleti logikát, ahol azt végre kell hajtania a következő funkciókat
Total current consumption = current from A elements + current from B elements.
A and B are different types of devices
Most tegyük ki az elemeket köteles szállítani a jelenlegi (A + B) lehet „X”
Szintén az egyes X járulhat hozzá a teljes áramfelvétel, így vennem kell számítani a teljes áramfelvétel újra ugyanolyan első lépés, beleértve az akkumulátor áramfelvétele
azaz
`Total current consumed : A + B + X`
where X is the current consumption of the battery
Most megint én kell számítani az elemeket szükséges. Mondjuk ezt az Y
azaz
hogy ellátási A + B + X”van szükségünk Y akkumulátorok száma.
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
Tud valaki segíteni nekem indulókészlete pszeudokód? Bármilyen javaslatot is nagyra értékelik,
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 ...













