TheShippingContainer.java
1    /*You’re interested in the longest object you can shove in a shipping container diagonally from the bottom in one corner to the top in another corner. 
2            Write a Java program called ShippingContainer in the shapes package to compute the distance from one corner of a rectangular shipping container on the floor (bottom) to its far corner on the ceiling (top). 
3            By rectangular shipping container I simply mean a container with rectangular walls, floor, and ceiling. 
4            Use a prompt and scanner to ask the user for three integer dimensions for the container – a width, length, and a height. 
5            Do this in a manner that is more or less consistent with the following guidelines: 
6     
7            Draw a nice diagram of the shipping container. 
8            Do your best to add a sketch of a “curtain” to the container which divides the container diagonally. Refer to this curtain as the “key” to solving this problem. 
9            Introduce a variable for each dimension of the container, bound to values read from the user via the standard input stream. 
10           Think about this: How can the key be used to help solve the problem? 
11           Think about this: What are the dimensions of the key? 
12           Think about this: How can you create the key? 
13           Introduce a variable called face and bind it to a rectangle that can be used to get the nonobvious dimension of the key. 
14           Introduce a variable called key and bind it to a rectangle that represents the key. 
15           Introduce a variable called distance and bind it to the distance of interest, the distance between two far corners of the container. 
16           Display the result, being sure to label it.*/
17   package shapes;
18   
19   import java.util.Scanner;
20   
21   public class TheShippingContainer {
22       public static void main(String[ ] args) {
23   
24           Scanner shippingScanner = new Scanner(System.in);
25           double height = shippingScanner.nextDouble();
26           System.out.println("You've set height to: " + height);
27           double width = shippingScanner.nextDouble();
28           System.out.println("You've set width to: " + width);
29           double length = shippingScanner.nextDouble();
30           System.out.println("You've set length to: " + length);
31           System.out.println();
32           double dimensions = (2 * (((width*length) + (height * length)) + (height * width)));
33           System.out.println("Dimensions of shipping container are: " + dimensions);
34   
35           SRectangle face = new SRectangle(height,length);
36           //TODO Ask TA's for help on what the key is and what the nonobvious thing is
37           double diagonalOfHeightLength = face.diagonal();
38           System.out.println("This is the diagonal based on the height and width: " + diagonalOfHeightLength);
39           SRectangle key = new SRectangle (diagonalOfHeightLength, width);
40           double distance = key.diagonal();
41           System.out.println("This is the diagonal of the needed thing: " + distance);
42   
43   
44           /* 
45           Let's try instead to make all the sides of the rectangular prism 
46    
47    
48           SRectangle leftFace  = new SRectangle(height,length); 
49           SRectangle rightFace = new SRectangle(height,length); 
50           SRectangle frontFace = new SRectangle(height,width); 
51           SRectangle backFace  = new SRectangle(height,width); 
52           SRectangle topFace   = new SRectangle(width,length); 
53           SRectangle bottomFace= new SRectangle(width,length); 
54    
55           //distance 
56           double Dis = topFace.diagonal(); 
57    
58    
59    
60    
61      */
62       }
63   }
64