ShippingContainer.java
1    /* 
2     *Program to compute the distance from one corner of a rectangular shipping container on the floor (bottom) 
3     * to its far corner on the ceiling (top). 
4     */
5    
6    package shapes;
7    
8    import java.util.Scanner;
9    
10   public class ShippingContainer {
11       public static void main (String[] args){
12           Scanner scanner = new Scanner(System.in);
13           //Introducing variables for each dimension of the container
14           int Width = scanner.nextInt();
15           int Length = scanner.nextInt();
16           int height = scanner.nextInt();
17           System.out.println("Width = " +Width+"\nLength = " +Length+"\nHeight = " +height);
18   
19           //Introducing a variable to find diagonal of the face which was the length of the key
20           SRectangle face = new SRectangle(height,Length);
21           double lengthOfKey = face.diagonal();
22   
23           //Introduce a variable called key to find the dimension of key
24           SRectangle key = new SRectangle(lengthOfKey,Width);
25           double distance = key.diagonal();
26           System.out.println("the distance between two far corners of the container = " + distance);
27   
28       }
29   }
30