This is for an Intermediate Java class I'm taking this semester. I'm having a problem with testing for out of bounds in an array in my class.
Here is the code that's in the driver program:
And here is the code for the addLine method:
This is the output it produces:
Out of bounds error or start and end points are the same.
Out of bounds error or start and end points are the same.
Out of bounds error or start and end points are the same.
Out of bounds error or start and end points are the same.
Can anyone tell me why it is producing 4 outputs when only three sets of numbers are put through the test? The method tests whether the supplied numbers are not out of bounds of the 2D array, and whether the start and end points do not equal each other. The point of the driver code here is to make sure the driver rejects the numbers.
Also, I'm not sure if my code is correct to draw a straight line in an array of bytes. 0 is a black pixel, 1 is a white pixel. So I have a 2D array of bytes (pixels).
Thanks for any help on this!
Here is the code that's in the driver program:
And here is the code for the addLine method:
This is the output it produces:
Out of bounds error or start and end points are the same.
Out of bounds error or start and end points are the same.
Out of bounds error or start and end points are the same.
Out of bounds error or start and end points are the same.
Can anyone tell me why it is producing 4 outputs when only three sets of numbers are put through the test? The method tests whether the supplied numbers are not out of bounds of the 2D array, and whether the start and end points do not equal each other. The point of the driver code here is to make sure the driver rejects the numbers.
Also, I'm not sure if my code is correct to draw a straight line in an array of bytes. 0 is a black pixel, 1 is a white pixel. So I have a 2D array of bytes (pixels).
Thanks for any help on this!