1 package shapes; 2 import java.util.Scanner; 3 /* 4 * Calculates the distance from the top corner of a shipping container to the bottom corner of the shipping container using NPW shapes. 5 */ 6 7 public class ShippingContainer { 8 public static void main(String[] args) 9 { 10 Scanner kmart = new Scanner(System.in); 11 12 System.out.println("Enter width: "); 13 int width = kmart.nextInt(); 14 15 System.out.println("Enter length: "); 16 int length = kmart.nextInt(); 17 18 System.out.println("Enter height: "); 19 int height = kmart.nextInt(); 20 21 SRectangle face = new SRectangle(width, length); 22 SRectangle key = new SRectangle(height, face.diagonal()); //"divider" within the rectangle 23 24 double distance = key.diagonal(); //diagonal of key is the distance from the top corner to the bottom corner 25 System.out.println("distance = " + distance); 26 27 } 28 } 29