Alvaroo Hernandez wrote:
When i run this it outputs nothing anybody know why? i ran the others and they where right except for this one
I don't know if you realize what is happening on lines 11, 13, 16, and 18. The expression that you are passing to System.out.print() is an assignment expression which is first executed. The value passed to print() is the value assigned to d. It appears to work but there is one flaw in this: when the condition on line 15 is false, execution does not fall through to the else on line 17 because that else is part of the if-statement on line 14. You probably thought otherwise and expected line 18 to be executed, so you answered 99. In this case, none of the System.out.print() statements will be executed so you will not get any output.
If you do this instead, you will get the output that will show you the answer for any case.
Thanks!! i can see where it went wrong since the value for d was already established and since none of the statements were satisfied it should be 44. I feel dumb right now how did i not catch that Thanks again everyone as i am barely learning java i will get the hang of it with time