#question about this getBalance method
1 messages ยท Page 1 of 1 (latest)
While you are waiting for getting help, here are some tips to improve your experience:
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?
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
same i think
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.
so things on conditions are not passed through ()?
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.