| 1 | package Question9_10; |
| 2 | |
| 3 | public class Box { |
| 4 | public int width; |
| 5 | public int height; |
| 6 | public int depth; |
| 7 | public Box(int w, int h, int d) { |
| 8 | width = w; |
| 9 | height = h; |
| 10 | depth = d; |
| 11 | } |
| 12 | |
| 13 | public boolean canBeUnder(Box b) { |
| 14 | if (width > b.width && height > b.height && depth > b.depth) { |
| 15 | return true; |
| 16 | } |
| 17 | return false; |
| 18 | } |
| 19 | |
| 20 | public boolean canBeAbove(Box b) { |
| 21 | if (b == null) { |
| 22 | return true; |
| 23 | } |
| 24 | if (width < b.width && height < b.height && depth < b.depth) { |
| 25 | return true; |
| 26 | } |
| 27 | return false; |
| 28 | } |
| 29 | |
| 30 | public String toString() { |
| 31 | return "Box(" + width + "," + height + "," + depth + ")"; |
| 32 | } |
| 33 | } |
nothing calls this directly
no outgoing calls
no test coverage detected