wondering why this code wont work..

A bunch of conventions are coming to town, and you are a hotel

manager. The conventions are numbered from 1 through n.

Convention i ends at time i. You can't host more than

one convention at a time.You want to maximize the

*number* of conventions you host. (Assume they all present

the same profit.) If you host convention i, then any later

conventions you host must begin at time i+1 or greater.

publicstaticint maxConventions (int n,int [] Begin)

{

if(n<1)return 0;

elsereturn 1+maxConventions(n,Begin[n]-1)+ maxConventions(n-1,Begin);

}

ok im just stupid but its bringing back a error of The method maxConventions(int, int[]) in the type conventions is not applicable for the arguments (int, int) ... sorry for the stupidity but why is it doin this?

[1189 byte] By [JavaBamfa] at [2007-11-26 20:09:10]
# 1

else return 1+maxConventions(n,Begin[n]-1)+ maxConventions(n-1,Begin);

Look at this part in particular:

maxConventions(n,Begin[n]-1)

Begin[n] is an int, not an int[]. If you read the error messages, they tell you exactly what is going wrong.

CaptainMorgan08a at 2007-7-9 23:12:12 > top of Java-index,Java Essentials,Java Programming...
# 2
Well, maxConventions is declared to take (int, int[]), but in maxConventions(n,Begin[n]-1), n is an int and Begin[n]-1 is an int as well, rather than an int[].
beckiergba at 2007-7-9 23:12:12 > top of Java-index,Java Essentials,Java Programming...
# 3
It's telling you exactly what's wrong: The method takes an int and an int[], but you're calling it with two ints.
jverda at 2007-7-9 23:12:12 > top of Java-index,Java Essentials,Java Programming...