Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Ok, so for the most part I have my code working but I can\'t seem to figure out

ID: 667187 • Letter: O

Question

Ok, so for the most part I have my code working but I can't seem to figure out the statement to read the arguments in lexicographic order:

Here is my code:

public class Argulyzer {

private String argulyze(String[] args) {

if(args != null && args.length > 0 && args[0] != null) {

String key = (String) args[0];

return "one";

}

for(int c=0;c<args.length;c++) {

System.out.println("testing");

}

return "none";

}

public static void main(String[] args) {

Argulyzer a = new Argulyzer();

System.out.println(a.argulyze(args));

}

}

Explanation / Answer

public class Argulyzer {

    private String argulyze(String[] args) {

    //work here

    // if 1 args return "one" if 2 return larger if 3+ return smallest

        for(int c=0;c<args.length;c++){

            System.out.println("testing");

            }       

        return "none";

    }

    public static void main(String[] args) {

        Argulyzer a = new Argulyzer();

        System.out.println(a.argulyze(args));

    }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote