Math in java
[I]Array[i].fee = ((Array.num / ((((double)number2 / 100) + 1)))) * (((double)number1 / 100) + 1);
Isn't coming out the way I want it to...
number2 = 10
number1 = 15
number2 and number1 are both int values, but I thought the typecasts I used would have helped.
(((double)number2 / 100) + 1))) is coming out 1.0 when it should be 1.1
(double)number1 / 100) + 1) is coming out as 1.1 when it should be 1.15
Maybe I've done something wrong but I can't pick it, been sitting for an hour at this code.
Print the steps out separately instead of waiting until the whole expression is evaluated to see what's going on.
Hint: what is being cast as a double in each of the following?
(double) number2 / 100
(double) (number2 / 100)
((double) number2) / 100
ahh, I figured it out, actually wasn't my type casting.. just screwed up in one of my base methods <_<