in arrays & methods 1.) What will be returned when mysteryFunction(7) is called?
ID: 3767240 • Letter: I
Question
in arrays & methods
1.)
What will be returned when mysteryFunction(7) is called?
public int mysteryFunction (int startNum)
{
int result = 0;
while (startNum <= 10)
{
result = startNum * 2;
startNum = startNum + 1;
}
return result;
}
2.)
Write a public static method header lapConverter that takes an integer parameter named laps and returns miles rounded to the nearest hundredth.
_________________________________________________________________( __________________________ )
{
//code not required, only the header above.
}
3.) true or false?
You can have doubles and integers in the same array
4.)
The following method will take a users input of distance traveled and calculate the percentage of the diameter of the Earth that this distance represents rounded to the nearest hundredth. Complete the method header:
public static __________ percentOfTheEarth ( int miles )
5.) true or false?
Arrays have a length method to retrieve how many elements are in an array.
Explanation / Answer
public int mysteryFunction (int startNum)
{
int result = 0;
while (startNum <= 10)
{
result = startNum * 2;
startNum = startNum + 1;
}
return result;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.