1 package shapes; 2 3 import java.util.Scanner; 4 5 //I must use scanner to get length width and height of shipping container 6 public class ShippingContainer { 7 public static void main(String[] args) { 8 Scanner scan = new Scanner(System.in); 9 System.out.print("Please enter Shipping Container height: "); 10 double height = scan.nextDouble(); 11 System.out.print("Please enter Shipping Container length: "); 12 double length = scan.nextDouble(); 13 System.out.print("Please enter Shipping Container width: "); 14 double width = scan.nextDouble(); 15 //System.out.println("height " + height + " length " + length + " width " + width); 16 /*First I make a rectangle for the bottom of the box, which uses length and width. 17 I need this to make the next rectangle because I must make an imaginary rectangle 18 laying on the diagonal of the bottom of the box which is called face. 19 This mimics the (pythagorean theorem). 20 */ 21 SRectangle face = new SRectangle(length, width); 22 double lengthOfImaginaryRec = face.diagonal(); 23 /*lengthOfImaginaryRec is the length of the imaginary rectangle, I will need it to get the diagonal 24 in which the item will lay upon. 25 Now I make the rectangle key. The diagonal of this rectangle should be my answer. 26 */ 27 SRectangle key = new SRectangle(lengthOfImaginaryRec, height); 28 double distance = key.diagonal(); 29 System.out.println("The longest item that can fit in a shipping container diagonally from a bottom corner to a top corner is: " + distance); 30 31 32 } 33 } 34