ShippingContainer.java
1    package shapes;
2    
3    import java.util.Scanner;
4    
5    public class ShippingContainer {
6        public static void main(String[] args) {
7            //Create scanner object
8            Scanner scanner = new Scanner (System.in);
9            System.out.print("Enter the width of the shipping container: ");
10           double widthOfContainer = scanner.nextDouble();
11           System.out.print("Enter the length of the shipping container: ");
12           double lengthOfContainer = scanner.nextDouble();
13           System.out.print("Enter the height of the shipping container: ");
14           double heightOfContainer = scanner.nextDouble();
15   
16           // the curtain/key to solving the problem is...a SRectangle that has the height that is the diagonal of
17           // SRectangle(heightOfContainer,widthOfContainer), and has the width that is lengthOfContainer. The diagonal of
18           // this SRectangle will be the answer to this problem
19   
20           SRectangle keyRec = new SRectangle (heightOfContainer, widthOfContainer);
21           double keyHeight = keyRec.diagonal();
22           SRectangle key = new SRectangle (keyHeight, lengthOfContainer);
23   
24           //The answer to the problem
25           double answerToShippingContainerProblem = key.diagonal();
26   
27           //Display the answer
28           System.out.println("The distance from one corner of a rectangular shipping container on the floor to its far corner on the ceiling is " + answerToShippingContainerProblem);
29   
30   
31   
32   
33   
34   
35       }
36   }
37