1 package shapes; 2 3 import java.util.Scanner; 4 5 public class ShippingContainer { 6 public static void main(String[] args) { 7 //creating a scanner that will ask for and record the length, width, and height of the container 8 Scanner s = new Scanner(System.in); 9 System.out.println("Length?"); 10 double length = s.nextDouble(); 11 System.out.println("Width?"); 12 double width = s.nextDouble(); 13 System.out.println("Height?"); 14 double height = s.nextDouble(); 15 //creating the 'face' 16 SRectangle face = new SRectangle(length,height); 17 //finding the diagonal of face to get the side length of the key 18 double fdig = face.diagonal(); 19 //creating the key 20 SRectangle key = new SRectangle(fdig,width); 21 //finding the diagonal of key to get the distance 22 double distance = key.diagonal(); 23 //displaying the result 24 System.out.println("The longest object that can be fit in the container is "+distance+" units long"); 25 26 27 } 28 } 29