ShippingContainer.java
1      /* 
2       * this program will compute the distance from one corner of shipping container to 
3       * its far corner. 
4       */
5    
6    
7      package shapes;
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   
14                 System.out.println("Enter an integer:");
15                 int length= scanner.nextInt(); //8
16                 System.out.println("Length="+ length);
17                 int width= scanner.nextInt();  //5
18                 System.out.println("Width="+width);
19                 int height= scanner.nextInt(); //6
20                 System.out.println("Height="+height);
21   
22                 //introduce the face,key and rectangle.
23   
24                 SRectangle face= new SRectangle(length, height );
25                 System.out.println("areaOfFace="+face.area());
26   
27                 SRectangle key= new SRectangle(face.diagonal(), width);
28                 System.out.println("areaOfKey="+key.area());
29                 double diagonal= key.diagonal();
30                 System.out.println("Distance between diagonal corner="+diagonal);
31   
32             }
33     }
34