ShippingContainer.java
1    /* 
2     * Program to calculate the longest possible object that con fit within a shipping container. 
3     * This will account for the length, width, and height of the container 
4     */
5    
6    package shapes;
7    
8    import java.util.Scanner;
9    
10   public class ShippingContainer {
11       public static void main(String[] args) {
12           //create scanner
13           Scanner scanner = new Scanner(System.in);
14           //get length
15           System.out.println("Please enter the length (m).");
16           double containerLength = scanner.nextDouble();
17           //get width
18           System.out.println("Please enter the width (m).");
19           double containerWidth = scanner.nextDouble();
20           //get height
21           System.out.println("Please enter the height (m).");
22           double containerHeight = scanner.nextDouble();
23           //calculate key length
24           SRectangle containerBase = new SRectangle(containerLength,containerWidth);
25           double keyLength = containerBase.diagonal();
26           //calculate "distance"
27           SRectangle key = new SRectangle(keyLength,containerHeight);
28           double distance = key.diagonal();
29           //print out results
30           System.out.println("Distance of interest = " + distance + " meters");
31       }
32   }
33