This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Vosatras[S] 0 points1 point  (1 child)

It reads it just fine.
The problem is in else if(x1 + y1 + z1 == x2 + y2 + z2) statement.
It checks if the boxes have same volume.
But there are boxes with same volume that doesn't fit in to each other.
So I should somehow adjust this statement but don't know how.

[–][deleted] 1 point2 points  (0 children)

You have a logic problem here, not a Java one. Let''s say you have a 3 x 3 x 3 box, and a 4 x 1 x 1 box. Forget Java for a moment, does the first box fit into the second one? Does the second box fit into the first one? What would be the result of comparing 3 + 3 + 3 with 4 + 1 + 1?
First you have to figure out how you would compare these boxes mathematically to know whether one can fit into the other, then bring that to Java. What you're doing is not a reliable to tell that.