ShippingContainer.java
1    /* 
2    A program to calculate and display what is the longest object 
3    you can fit into a shipping container diagonally. 
4     */
5    
6    package shapes;
7    
8    import java.util.Scanner;
9    
10   public class ShippingContainer {
11   
12       public static void main(String[] args) {
13   
14           //Collect user input of container dimensions
15           Scanner input = new Scanner(System.in);
16   
17           System.out.print("What is the container's width? ");
18           double width = input.nextInt();
19   
20           System.out.print("What is the container's height? ");
21           double height = input.nextInt();
22   
23           System.out.print("What is the container's length? ");
24           double length = input.nextInt();
25   
26           //Create a diagonal curtain in the container
27           SRectangle ceiling = new SRectangle(width,length);
28           double face = ceiling.diagonal();
29           SRectangle key = new SRectangle (face,height);
30   
31           //calculate and display the final result
32           double distance = key.diagonal();
33           System.out.println("The largest object that can fit into this container is " + distance + " units long");
34       }
35   }
36