Respuesta :

Answer:

import java.io.*;  

public class Main {

   public static void main(String[] args) throws IOException {

       BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

       // Box 1

       System.out.println("Length:");

       int length = Integer.parseInt(in.readLine());

       System.out.println("Width:");

       int width = Integer.parseInt(in.readLine());

       System.out.println("Height:");

       int height = Integer.parseInt(in.readLine());

       // Box 2

       System.out.println("Length:");

       int length2 = Integer.parseInt(in.readLine());

       System.out.println("Width:");

       int width2 = Integer.parseInt(in.readLine());

       System.out.println("Height:");

       int height2 = Integer.parseInt(in.readLine());

       System.out.println(boxComparison(length, width, height, length2, width2, height2));

   }

   public static boolean boxComparison(int l, int w, int h, int l2, int w2, int h2) {

       return l == l2 && w == w2 && h == h2;

   }

}

Explanation:

You did not specify the attributes of the box, but assuming you mean just the dimensions (length, width, and height), then simply write a method that checks if the length is equal to the length of the second box, and apply the same methodology with the remaining attributes.

So you take an input for the length, width, and height for each box, and then do a boolean method that checks if their attributes are the same or not. If they are the same, simply return true, else return false.

ACCESS MORE
EDU ACCESS