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

public static double secret(int first, double second) { double temp; if (second

ID: 3639925 • Letter: P

Question

public static double secret(int first, double second)
{
double temp;

if (second > first)
temp = first * second;
else
temp = first - second;

return temp;
}

What is the name of the method in the accompanying figure?
a) first
b) second
c) secret
d) double




public static double secret(int first, double second)
{
double temp;

if (second > first)
temp = first * second;
else
temp = first - second;

return temp;
}

What is the return type of the method in the accompanying figure?

a) public
b) int
c) void
d) double




public static double secret(int first, double second)
{
double temp;

if (second > first)
temp = first * second;
else
temp = first - second;

return temp;
}

Based on the code in the accompanying figure, what would be the output of the following statement?

System.out.println(secret(5, 7.0));

a) 5.0
b) 7.0
c) 2.0
d) 35.0




public int mystery(int x, int y)
{
if (x >= y)
return x - y;
else
return x + y;
}

Based on the code in the accompanying figure, what would be the output of the following statement?

System.out.println(mystery(8, mystery(2, 1));

a) 5
b) 7
c) 11
d) 13


Explanation / Answer

name of the method in the accompanying figure is c) secret return type of the method in the accompanying figure is d) double Based on the code in the accompanying figure, the output of the following statement will be d) 35.0 Based on the code in the accompanying figure, the output of the following statement will be b) 7