Given a rectangular object and several boxes (in this problem, we ignore the height of the box, so a box only has two dimensions) of different sizes, you want to find the box with the smallest area which is large enough to contain the object. When putting the object in the box, it's sides must be parallel with the sides of the box. Thus, you may only rotate the object 0, 90, 180 or 270 degrees (although for obvious reasons you only need to consider rotating with 0 and 90 degrees).
Create a class ObjectPacking which contains the method smallBox which takes an int objWidth, an int objLength (the width and length of the object), a int boxWidth, a int boxLength (the width and length of the boxes) and returns an int, the area of the smallest box that can fit the object. Element i in boxWidth and boxLength correspond to box i. If no box is big enough to contain the object, return -1.
|Parameters:||int, int, int, int|
|Method signature:||int smallBox(int objWidth, int objLength, int boxWidth, int boxLength)|
|(be sure your method is public)|
|-||There doesn't have to be any gap between the sides of an object and the sides of the box. Thus, an object with width 5 and length 7 will fit in a box with width 7 and length 5.|
|-||Return -1 if there is no box big enough to contain the object (see example 1).|
|-||objWidth will be between 1 and 1000, inclusive.|
|-||objLength will be between 1 and 1000, inclusive.|
|-||boxWidth will contain between 1 and 50 elements, inclusive.|
|-||boxLength will contain between 1 and 50 elements, inclusive.|
|-||boxWidth will contain the same number of elements as boxLength.|
|-||Each element in boxWidth will be between 1 and 1000, inclusive.|
|-||Each element in boxLength will be between 1 and 1000, inclusive.|
|By rotating the object 90 degrees we can precisely fit it into the only box in the list, so the method should return 21 (7*3).
|The object can't fit in any of the boxes, no matter if we rotate it or not. The method should thus return -1.
|The object will fit in box 0, 1 and 3. The area of box 1 and 3 are 200 while the area of box 0 is 228, so the method should return 200.