.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
.
Last edited by Aeoip9; November 27th, 2018 at 11:55 PM.
It looks like the 222 was added to the last group instead of being subtracted.should return 555,333,333 but it gives me 555,333,777.
Is the sign being lost?
If you don't understand my answer, don't ignore it, ask a question.
Can you post the console's contents that shows what you are asking about?
Add some comments (<<<<< HERE) to mark and describe where the issue is.
Probably not. How are you trying to debug the code to see where the problem is?I'm not sure if im using the negative signs correctly
If you don't understand my answer, don't ignore it, ask a question.
Work on one problem at a time. Pick one of the cases where the code fails and do some debugging to see why it doesn't get the desired results.
For debugging, I use print statements to show the values of variables as they are used and their values are changed.
Make a test case that only does one call to add with parameters that are not being added correctly.
Comments on the code:
There are a lot of places where the code is not properly formatted. The indentations of statements and the alignment of { and } don't show the logical nesting of statements making the code harder to read and understand.
There are very few comments in the add() method.
If you don't understand my answer, don't ignore it, ask a question.