logo Practice-It logo

parameter mystery

Author: Marty Stepp (on 2012/11/19)

Given the following program:

public class ParameterMystery {
    public static void main(String[] args) {
        String scarlett = "mustard";
        String suspect = "peacock";
        String lounge = "ballroom";
        String pipe = "study";
        String dagger = "pipe";
        String weapon = "dagger";

        clue(weapon, suspect, pipe);
        clue(scarlett, pipe, suspect);
        clue(dagger, "lounge", scarlett);
        clue(lounge, dagger, "dagger");
        clue(pipe, "miss " + scarlett, lounge);
    }

    public static void clue(String suspect, String room, String weapon) {
        System.out.println(room + " in the " + weapon + " with the " + suspect);
    }
}

Write the output of each of the following calls, as it would appear on the console.

clue(weapon, suspect, pipe);
clue(scarlett, pipe, suspect);
clue(dagger, "lounge", scarlett);
clue(lounge, dagger, "dagger");
clue(pipe, "miss " + scarlett, lounge);

You must log in before you can solve this problem.


Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.