logo Practice-It logo

BJP4 Self-Check 3.6: parameterMysteryNumbers

Author: Marty Stepp (on 2016/09/08)

Given the following program:

public class MysteryNumbers {
    public static void main(String[] args) {
        String one = "two";
        String two = "three";
        String three = "1";
        int number = 20;

        sentence(one, two, 3);
        sentence(two, three, 14);
        sentence(three, three, number + 1);
        sentence(three, two, 1);
        sentence("eight", three, number / 2);
    }

    public static void sentence(String three, String one, int number) {
        System.out.println(one + " times " + three + " = " + (number * 2));
    }
}

Write the output of each of the following calls.

sentence(one, two, 3);
sentence(two, three, 14);
sentence(three, three, number + 1);
sentence(three, two, 1);
sentence("eight", three, number / 2);

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.