subject

Fill in the missing code: this recursive method returns "even" if the length of a give string is even, and "odd" if the length of the string is odd.

public static string foo(string s)

{

if (s. length() ==0)
return "even";
else if (s. length() = = 1)
return "odd";
else

//your code goes here

}

(40 pts) you coded the following in the file test. java :
system. out. println( foo(5));
//more code here

public static int foo(int n) //line 9

{

if (n = = 0)
return 1;
else

system. out. println(n* foo(n-1) );

} //line 15

at compile time, you get the following error:
text. java: 15: missing return statement

} //line 15

^

1 error

explain what the problem is and how to fix it.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 18:00
What can a word user do with the customize ribbon dialog box? check all that apply. minimize the ribbon add a new tab to the ribbon remove a group from a tab add a group to a tab choose which styles appear choose which fonts appear choose tools to appear in a group
Answers: 1
question
Computers and Technology, 24.06.2019 10:40
Joe needs to see the slide transitions and animations he has applied to his slides in a large view. which presentation view should he use? in which tab would joe find the animations option to make further changes, if any?
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
Ais a built in formula in spread spread a is any math process such as addition or subtraction. options are function and operation
Answers: 1
question
Computers and Technology, 24.06.2019 15:00
Universal windows platform is designed for which windows 10 version?
Answers: 1
You know the right answer?
Fill in the missing code: this recursive method returns "even" if the length of a give string is ev...
Questions
question
Mathematics, 05.12.2019 20:31
Questions on the website: 13722360