ShippingContainer.java
1    /* 
2    A program to compute the distance from one corner of a rectangular shipping container on the floor to its far corner on the ceiling 
3     */
4    package shapes;
5    
6    import java.util.Scanner;
7    
8    public class ShippingContainer {
9    
10       public static void main(String[] args) {
11           Scanner scanner = new Scanner(System.in);
12           System.out.println("Enter the width of shipping container:");
13           double width = scanner.nextDouble();
14   
15           System.out.println("Enter the length of shipping container:");
16           double length = scanner.nextDouble();
17   
18           System.out.println("Enter the height of shipping container:");
19           double height = scanner.nextDouble();
20   
21           SRectangle rec = new SRectangle(width, length);
22           SRectangle key = new SRectangle(height, rec.diagonal());
23           double curtain = key.diagonal();
24           double keyArea = key.area();
25           double keyWidth = key.width();
26           double keyHeight = key.height();
27   
28   //Print the area, width, height, and distance of the container.
29           System.out.println("The area of the container is: " + keyArea);
30           System.out.println("The width of the container is: " + keyWidth);
31           System.out.println("The height of the container is: " +  keyHeight);
32           System.out.println("The distance across the container is: " + curtain);
33       }
34   }