ShippingContainer.java
1    /* 
2     *Assignment 3 Problem 4: The Shipping Container 
3     */
4    package shapes;
5    
6    import java.util.Scanner;
7    
8    public class ShippingContainer {
9        public static void main (String[] args) {
10           //width of the container is =
11           System.out.print("Container Width = ");
12           Scanner scanner = new Scanner(System.in);
13           Double width = scanner.nextDouble();
14           //length of the container is =
15           System.out.print("Container Length = ");
16           Double length = scanner.nextDouble();
17           //height of the container is =
18           System.out.print("Container Height = ");;
19           Double height = scanner.nextDouble();
20           //face is the side of the container so diagonal of the face is the height of the key
21           SRectangle face = new SRectangle(height,length);
22           //key is the rectangle from the top left to bottom right so diagonal of the key is the farthest
23           //length that can fit in the container
24           SRectangle key = new SRectangle(face.diagonal(),width);
25           Double distance = key.diagonal();
26           System.out.println("Distance between two farthest corners of the container = " + distance);
27   
28   
29   
30       }
31   
32   }
33