This class contains a number of syntax and semantic errors. Your job is to find them all. public Class DebugMe{     public static void main(String args[]){         printSums(args);         compareBoxes();     }     //This function is designed to print the sums of all numbers between 1 and the     //first number entered as an argument to DebugMe     //For example, if you enter:  DebugMe 3     //You should get:     //    The sum of the first 1 numbers is 1.     //  The sum of the first 2 numbers is 3.     //  The sum of the first 3 numbers is 6.     public static void printSums(String[] args){     {         int count;         count = Integer.parseInt(args);         for (i = 1 ; i <= count ; i++);         {             int sum = 0;             int i = 0;             sum += i - 1;             System.out.println("The sum of the first " + i + " numbers is " + sum + ".");         }     }     //This function demonstrates the use of the Box class     //DO NOT change anything in this function     //use it to test your corrections to the Box class     //The following is what your output should look like when your     //Box class is correct.     //Box 0 is larger than Box 1.     //Box 0 is equivalent to Box 2.     //Box 0 is smaller than Box 3.     //Box 0 is larger than Box 4.     //Box 1 is smaller than Box 2.     //Box 1 is smaller than Box 3.     //Box 1 is smaller than Box 4.     //Box 2 is smaller than Box 3.     //Box 2 is larger than Box 4.     //Box 3 is larger than Box 4.     public static void compareBoxes(){         Box[] array = new Box[5];         array[0] = new Box(4,5,3,2);         array[1] = new Box(2,3,3,1);         array[2] = new Box(3,10,2,2);         array[3] = new Box(4,4,4,1);         array[4] = new Box(5,7,1,1);         for(int i = 0; i< array.length;i++){             for(int j=i+1; j< array.length;j++){                 //compare for box equivalency                 if(array[i].equals(array[j])){                     System.out.println("Box " + i + " is equivalent to " + j + ".");                 }                 else                 {                     //compare box sizes                     if(array[i].equals(array[i].larger(array[j])))                     {                         System.out.println("Box " + i + " is larger than Box " + j + ".");                     }                     else                     {                         System.out.println("Box " + i + " is smaller than Box " + j + ".");                     }                 }             }         }     } }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

This class contains a number of syntax and semantic errors.
Your job is to find them all.

public Class DebugMe{

    public static void main(String args[]){

        printSums(args);
        compareBoxes();
    }

    //This function is designed to print the sums of all numbers between 1 and the
    //first number entered as an argument to DebugMe
    //For example, if you enter:  DebugMe 3
    //You should get:
    //    The sum of the first 1 numbers is 1.
    //  The sum of the first 2 numbers is 3.
    //  The sum of the first 3 numbers is 6.

    public static void printSums(String[] args){
    {

        int count;

        count = Integer.parseInt(args);

        for (i = 1 ; i <= count ; i++);
        {
            int sum = 0;
            int i = 0;
            sum += i - 1;
            System.out.println("The sum of the first " + i + " numbers is " + sum + ".");
        }
    }


    //This function demonstrates the use of the Box class
    //DO NOT change anything in this function
    //use it to test your corrections to the Box class

    //The following is what your output should look like when your
    //Box class is correct.

    //Box 0 is larger than Box 1.
    //Box 0 is equivalent to Box 2.
    //Box 0 is smaller than Box 3.
    //Box 0 is larger than Box 4.
    //Box 1 is smaller than Box 2.
    //Box 1 is smaller than Box 3.
    //Box 1 is smaller than Box 4.
    //Box 2 is smaller than Box 3.
    //Box 2 is larger than Box 4.
    //Box 3 is larger than Box 4.


    public static void compareBoxes(){

        Box[] array = new Box[5];
        array[0] = new Box(4,5,3,2);
        array[1] = new Box(2,3,3,1);
        array[2] = new Box(3,10,2,2);
        array[3] = new Box(4,4,4,1);
        array[4] = new Box(5,7,1,1);

        for(int i = 0; i< array.length;i++){
            for(int j=i+1; j< array.length;j++){
                //compare for box equivalency
                if(array[i].equals(array[j])){
                    System.out.println("Box " + i + " is equivalent to " + j + ".");
                }
                else
                {
                    //compare box sizes
                    if(array[i].equals(array[i].larger(array[j])))
                    {
                        System.out.println("Box " + i + " is larger than Box " + j + ".");
                    }
                    else
                    {
                        System.out.println("Box " + i + " is smaller than Box " + j + ".");
                    }

                }

            }
        }

    }
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY