#question about this getBalance method

1 messages ยท Page 1 of 1 (latest)

runic solarBOT
#

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

runic solarBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, 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>.

#

e > 500000)
interestRate = 0.02;
else
interestRate = 0.01;

int interest = (int) (balance * interestRate);
return interest;
}```

What is the purpose of the getBalance() method in this code?

plain void
#

Depends, are you passing a different interest rate each time? Or same? In your given example interest rate is fixed and defined inside of method definition

prisma vigil
#

same i think

plain void
#

So that's why we didn't pass it, we kept it inside where it's needed. Since there's two rates based on condition, that's why we declared em in separate conditions.

prisma vigil
#

so things on conditions are not passed through ()?

plain void
#

Conditions are just conditions, it has no relation with something being passed upon or not. If your method relies on data from somewhere else, then you pass it using "arguments" which are called "parameters" when defined in method definition.