# Thread: can anyone help me out with this problem?

1. Member
Join Date
Apr 2012
Posts
1
Rep Power
0

## can anyone help me out with this problem?

1. This problem is based on an analysis of the following code segment:

public int multiply( int n )

{

if (n == 0)

return 1;

else if (n % 2 ==1)

return n;

else

return n * multiply( n - 2);

}

a) What is the output of the method call multiply(8)? (Hint: make a program with comments and submit it or just perform a code analysis!)

b) What do you notice about the bolded text in regards to programming? What is this programming concept called? Explain this concept. Back up your explaination by writing out each step in the code. Be prepared to discuss.

2. This problem is based on an analysis of the following code segment:

public in f1( int x )

{

if ( x == 0 )

return 0;

else

return f2( x - 2 );

}

public in f2( int x )

{

if ( x == 1 )

return 1;

else

return f1( x + 1 ) + x;

}

a) What is the output of the code given the method call f1(5)?

b) Write out each step of the method call. In other words, explain the answer.

3. Consider the following code segment:

public int recur(int n)
{
if (n<=10)
return n * 2;
else
return recur(recur(n / 3));
}

a) What output is produced by the method call recur(27)?

2. Senior Member
Join Date
Oct 2011
Posts
106
Rep Power
0

## Re: can anyone help me out with this problem?

Sorry, no one here is going to do your homework for you. Do you have a specific question you need answered?

3. ## Re: can anyone help me out with this problem?

AP computer science question

Why did you repeat the same question here, with something more tagged on? If there was something you didn't understand you should continue in the same thread.

db

5. ## Re: can anyone help me out with this problem?

Originally Posted by DarrylBurke
AP computer science question

Why did you repeat the same question here, with something more tagged on? If there was something you didn't understand you should continue in the same thread.
Are 'svo' and 'sawpbianca' one and the same person? Their IP address came from the same host ...

kind regards,

Jos

6. Member
Join Date
Apr 2012
Posts
9
Rep Power
0

## Re: can anyone help me out with this problem?

NO we are NOT one in the same person. I know who that is though. Our AP computer science teacher gave us this assignment over Spring Break and ENCOURAGED us to seek help in java forums... Kindly enough giving links to some supposedly 'helpful' ones. However, I found no help here.. or anywhere for that matter. My AP Barrons book did the trick. It makes more sense than all the baffouns here put together. Yet why our "ip address came from the same host" I don't know! But I'm sure as hell not retarded enough to make a second account to seek help from this forum...

thanks,
svo

7. ## Re: can anyone help me out with this problem?

Originally Posted by svo
NO we are NOT one in the same person. I know who that is though. Our AP computer science teacher gave us this assignment over Spring Break and ENCOURAGED us to seek help in java forums... Kindly enough giving links to some supposedly 'helpful' ones. However, I found no help here.. or anywhere for that matter. My AP Barrons book did the trick. It makes more sense than all the baffouns here put together. Yet why our "ip address came from the same host" I don't know! But I'm sure as hell not retarded enough to make a second account to seek help from this forum...
I remember I helped you out with a similar (identical?) question, so your remark about not receiving any help in this forum at all is simply incorrect and aamof quite rude.

Jos

8. Member
Join Date
Apr 2012
Posts
9
Rep Power
0

## Re: can anyone help me out with this problem?

Indeed. Quite rude... Beating around the bush when someone is trying to actually learn something is not rude? I wasn't asking for an answer. I was simply asking for guidance in what to do as we had never even covered this topic in our class. I apologize if you found the truth rude but you can all sit here on your silly non-helpful forums while I go out and actually learn stuff. And Fubarable can keep going around being even MORE un-helpful sucking up to other un-helpful people. Have a wonderful day!

With regards,
SVO

9. ## Re: can anyone help me out with this problem?

Originally Posted by svo
Indeed. Quite rude... Beating around the bush when someone is trying to actually learn something is not rude? I wasn't asking for an answer. I was simply asking for guidance in what to do as we had never even covered this topic in our class. I apologize if you found the truth rude but you can all sit here on your silly non-helpful forums while I go out and actually learn stuff. And Fubarable can keep going around being even MORE un-helpful sucking up to other un-helpful people. Have a wonderful day!

With regards,
SVO
Java Code:
`doNotHelpList.add(svo);`
With Regards,
Fubarable.

10. ## Re: can anyone help me out with this problem?

Originally Posted by svo
Indeed. Quite rude... Beating around the bush when someone is trying to actually learn something is not rude? I wasn't asking for an answer. I was simply asking for guidance in what to do as we had never even covered this topic in our class. I apologize if you found the truth rude but you can all sit here on your silly non-helpful forums while I go out and actually learn stuff. And Fubarable can keep going around being even MORE un-helpful sucking up to other un-helpful people. Have a wonderful day!
Plonk

Jos

11. Member
Join Date
Apr 2012
Posts
9
Rep Power
0

## Re: can anyone help me out with this problem?

I don't need help. Throw Error Exception.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•