Results 1 to 10 of 10
Thread: AP computer science question
 04062012, 08:04 PM #1Member
 Join Date
 Apr 2012
 Posts
 9
 Rep Power
 0
 04062012, 08:07 PM #2
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 13,309
 Blog Entries
 7
 Rep Power
 20
Re: AP computer science question
What do you think?
kind regards,
Joscenosillicaphobia: the fear for an empty beer glass
 04062012, 08:10 PM #3Member
 Join Date
 Apr 2012
 Posts
 9
 Rep Power
 0
Re: AP computer science question
Ahh well I tihnk that the second bolded 'multiply' is calling on the first 'multiply' method. But I don't know what the concept is at all. Is it something like a constructo
*edit* OHHH Is it method overloading?!?! (i'm looking around in my AP barrons book... my new best friend)Last edited by svo; 04062012 at 08:16 PM.
 04062012, 08:12 PM #4Member
 Join Date
 Apr 2012
 Posts
 9
 Rep Power
 0
Re: AP computer science question
part a) was that if you call the method multiply(8) then what is the output? I put that it was 8 and here is my reasoning:
1a)
You plug in 8 as the ‘int n’
if ‘n’ equals zero, it will return a value of one, however n is not zero it is eight so we move on
now if 8 modulus 2 is equal to one, meaning that ‘n’ is an odd integer, it returns the value of ‘n’ but it is not as 8 is an even number… so…
finally you do 8 * multiply( 82)
 multiply( 82)
(go through the same process for that)
multiply(6) > not equal to zero and is an even number so it will end up like this
 return 8 * multiply(62)
multiply(4) > not zero and is not odd so we can see that this pattern will eventually lead to: return 8 * multiply(o)
multiply(0) returns a value of 1 so 8*1 is 8
 04062012, 08:27 PM #5Member
 Join Date
 Apr 2012
 Posts
 9
 Rep Power
 0
Re: AP computer science question
I need your help please :[ I'm a super noooob
 04062012, 08:48 PM #6
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 13,309
 Blog Entries
 7
 Rep Power
 20
Re: AP computer science question
It's not a constructor because constructors don't have a return type and this method has one (int); in the body of the method it calls itself; it is named 'recursion'. Google is your friend here.
kind regards,
Joscenosillicaphobia: the fear for an empty beer glass
 04062012, 09:02 PM #7Member
 Join Date
 Apr 2012
 Posts
 9
 Rep Power
 0
Re: AP computer science question
Ohhhh Myyyy Gosshhhhh!!! I seee!! Yeah "Recursion"... Chapter 7 in the Barrons Book. Okay! thanks I will look into it
 04082012, 11:52 AM #8
Re: AP computer science question
Evidently continued in a new thread:
can anyone help me out with this problem?
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
 04082012, 11:52 AM #9
Re: AP computer science question
Cross posted
AP computer science questions
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
 04082012, 06:29 PM #10Member
 Join Date
 Apr 2012
 Posts
 9
 Rep Power
 0
Similar Threads

computer science newbie
By sixxvirus in forum New To JavaReplies: 17Last Post: 11182011, 08:30 AM 
Basic Java Computation Help Ap Computer Science
By Sean_J in forum New To JavaReplies: 6Last Post: 02102010, 01:10 PM 
Panic Attack Setting in Why did I take Computer Science...only to fail
By gallimaufry in forum New To JavaReplies: 5Last Post: 10252008, 08:42 AM 
Software Engineer...Computer Science Major
By giganews35 in forum IntroductionsReplies: 2Last Post: 09142008, 09:19 AM 
Help On Computer Science Final!!!! Java Program Help!!!!
By BSOS in forum New To JavaReplies: 1Last Post: 12112007, 04:54 AM
Bookmarks