मैं एक आवश्यकता एक आवेदन में एक तर्क लिखने के लिए (मुझे कम से कम के लिए चुनौतीपूर्ण) दिया गया है। मैं एक व्यावसायिक तर्क लिखने के लिए जिसमें यह निम्नलिखित कार्यक्षमता प्रदर्शन करना चाहिए है
Total current consumption = current from A elements + current from B elements.
A and B are different types of devices
अब कहते हैं कि बैटरी वर्तमान आपूर्ति करने की आवश्यकता की सुविधा देता है (ए + बी) हो 'एक्स'
इसके अलावा प्रत्येक एक्स कुल वर्तमान खपत में योगदान कर सकते हैं, इसलिए मैं सिर्फ बैटरी वर्तमान खपत सहित पहले कदम के रूप में फिर से कुल वर्तमान खपत की गणना करनी है
अर्थात
`Total current consumed : A + B + X`
where X is the current consumption of the battery
अब फिर से मैं आवश्यक बैटरी की गणना करना चाहिए। हमें वाई के रूप में इस मान लीजिए
अर्थात
आपूर्ति एक करने के लिए + बी + एक्स हम बैटरी के वाई नंबर की जरूरत है।
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 ...













