#I want to implement this logic but hard stuck with no ideas

1 messages · Page 1 of 1 (latest)

light summit
#

So i am trying to implement a logic in a java GUI, but this is a problem i am facing

I am calling two functions and i need to store the lowest result of both of the functions , then compare them

if the 2nd is bigger, then nothing happens
if the 1st is bigger, then compare the lowest of the 2nd to the array maintainenceCost

stuck cosmosBOT
#

<@&987246399047479336> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
So i am trying to implement a logic in a java GUI, but this is a problem i am facing I am calling two functions and i need to store the lowest result of both of the functions , then compare them if the 2nd is bigger, then nothing happens if the 1st is

gic from both functions in a variable. However, the logic from the second function depends on the output of the first function. How can I store and use the combined logic from both functions in my Java GUI?

One approach you can take is to create a method that calls both functions and returns the combined logic. Inside this method, you can call the first function and store its result in a variable. Then, based on this result, you can call the second function and combine its logic with the first function's result.

Another approach is to refactor your code so that the second function takes the output of the first function as a parameter. This way, you can directly pass the result of the first function to the second function and get the combined logic as an output.

Additionally, you can consider using lambda expressions or functional interfaces to represent your logic as objects. This can make it easier to combine and manipulate multiple functions' logic within your Java GUI.

Overall, by carefully designing your methods and considering how they interact with each other, you should be able to store and use combined logic from multiple functions in your Java GUI effectively.

light summit
#

this is my current code

light summit
light summit
#

if someone wants the formula : capitalCost - resaleValue of nth year + maintenanceCost till nth year is the formula

#

is my formula implementation over complicating stuff