ShippingContainer.java
1    /* 
2    Program to draw a shipping container 
3     */
4    
5    package shapes;
6    
7    import java.util.Scanner;
8    
9    public class ShippingContainer {
10       public static void main(String[] args){
11   
12           double length = length();
13           System.out.println("Length of the shipping container = " + length);
14   
15           double width = width();
16           System.out.println("Width of the shipping container = " + width);
17   
18           double height = height();
19           System.out.println("Height of the shipping container = " + height);
20   
21           SRectangle face = new SRectangle(width, length);
22           SRectangle key = new SRectangle(height, face.diagonal());
23           double distance = key.diagonal();
24           System.out.println("Distance between the corners of the rectangle = " + distance);
25       }
26   
27       private static double length() {
28           System.out.print("Length of the shipping container: ");
29           Scanner scanner = new Scanner(System.in);
30           double length = scanner.nextDouble();
31           return length;
32       }
33   
34       private static double width() {
35           System.out.print("Width of the shipping container: ");
36           Scanner scanner = new Scanner(System.in);
37           double width = scanner.nextDouble();
38           return width;
39       }
40   
41       private static double height() {
42           System.out.println("Height of the shipping container: ");
43           Scanner scanner = new Scanner(System.in);
44           double height = scanner.nextDouble();
45           return height;
46           }
47   
48       }
49   
50   
51