@Virkam The question is related a TopCoder problem and the error posted is given by the testing system.
The statement is here: http://community.topcoder.com/stat?c=problem_statement&pm=1677 There you can see that the *Definition *section specifies that a class named *Bonuses *should contain a public method called *getDivision*. I admit the OP failed to clearly express this situation, only a small mention to a so called "srm-3" and that's it. Carlos Guía On Fri, Oct 21, 2011 at 12:44 AM, Satyajit Bhadange < [email protected]> wrote: > @mandeep > > please write code in below method signature.Write your logic inside this > method and return int[] .if your logic is correct you will pass All system > test. > > > public class > Bonuses{ > > public int[] getDivision(int[] points){ > > return null; > > } > > } > > > > > > > > On Thu, Oct 20, 2011 at 5:48 PM, mandeep <[email protected]> wrote: > >> getting this error again and again... >> >> Correct Return Value: No >> >> Execution Time: 0.000s >> >> Could not find the necessary method. >> java.lang.NoSuchMethodException: Bonuses.getDivision([I) >> >> Standard Output: >> >> >> Standard Error: >> >> And here is code:- >> >> >> public class Bonuses { >> static int i,j,temp,avg=0,sum=0,l=0; >> //static String str="555555"; >> static int[] res=new int[20]; >> static int[] tar={1,2,3,4,5}; >> static int [] st=new int[20]; >> //st=Bonuses.getDivison(res); >> >> >> public int[] getDivison(int[] points) >> { >> for(l=0;l<points.length;l++) >> { >> avg+=points[l]; >> } >> for(j=0;j<points.length;j++) >> { >> res[j]=points[j]; >> res[j]=res[j]*100/avg; >> points[j]=res[j]; >> sum+=points[j]; >> //System.out.print(points[j]); >> } >> //System.out.println(sum); >> for(i=0;i<points.length;i++) >> >> for(j=i+1;j<points.length;j++) >> { >> if(res[j]>res[i]) >> { >> temp=res[j]; >> res[j]=res[i]; >> res[i]=temp; >> } >> } >> for(i=0;i<points.length;i++) >> { >> for(j=0;j<points.length&&sum!=100;j++) >> { >> if(res[i]==points[j]) >> { >> points[j]+=1; >> sum++; >> } >> } >> } >> return points; >> } >> public static void main(String as[]) >> { >> st=Bonuses.getDivison(tar); >> for(i=0;i<tar.length;i++) >> System.out.print(st[i]+" "); >> >> } >> } >> >> >> >> On Tue, Oct 18, 2011 at 11:29 PM, Vikram Gaur <[email protected]>wrote: >> >>> well in your earlier code you had declared getDivision as static method >>> and hence calling it with an object would be wrong. correct way would be to >>> call just the function directly. >>> >>> But with this new code you have given i think it should work fine. >>> >>> >>> >>> On Tue, Oct 18, 2011 at 11:24 PM, mandeep <[email protected]> wrote: >>> >>>> Well this code is written using main method. I have compiled this code >>>> many times,even compiled successfully, but i am getting 1 error during >>>> testing in topcoder arena. S >>>> But error is:-there is no such method Bonuses.getDivison(int[] ) >>>> So whether you main() method or not,i am getting this error.Or you can >>>> provide me another solution to this problem. >>>> Thanks...!!! >>>> >>>> >>>> >>>> public class Bonuses >>>> { >>>> static int i,j,temp,avg=0,sum=0,l=0; >>>> static int res[]=new int[20]; >>>> static int st[]=new int[20]; >>>> static int pt={1,2,3,4,5}; >>>> public int[] getDivison(int[] points) >>>> { >>>> for(l=0;l<points.length;l++) //firstly find out the sum >>>> { >>>> avg+=points[l]; >>>> } >>>> for(j=0;j<points.length;j++) >>>> { >>>> res[j]=points[j]; //then in res[] array result >>>> is stored.and sum is find out >>>> >>>> res[j]=res[j]*100/avg; >>>> points[j]=res[j]; >>>> sum+=points[j]; >>>> //System.out.print(points[j]); >>>> } >>>> //System.out.println(sum); >>>> for(i=0;i<points.length;i++) >>>> >>>> for(j=i+1;j<points.length;j++) //here element are sorted >>>> and store in res[] >>>> >>>> { >>>> if(res[j]>res[i]) >>>> { >>>> temp=res[j]; >>>> res[j]=res[i]; >>>> res[i]=temp; >>>> } >>>> } >>>> for(i=0;i<points.length;i++) //then we >>>> compare two array res[],points[] and larger value is increased by >>>> >>>> // 1 until sum=100 >>>> >>>> { >>>> for(j=0;j<points.length&&sum!=100;j++) >>>> { >>>> if(res[i]==points[j]) >>>> { >>>> points[j]+=1; >>>> sum++; >>>> } >>>> } >>>> } >>>> return points; //and then >>>> at final points is returned. >>>> } >>>> public static void main(String a[]) >>>> { >>>> Bonuses ob=new Bonuses(); >>>> st=ob.getDivison(pt); >>>> for(i=0;i<pt.length();i++) >>>> //System.out.println(st[i]); >>>> >>>> >>>> >>>> } >>>> } >>>> >>>> On Tue, Oct 18, 2011 at 10:59 AM, Mohamed h. Gaber < >>>> [email protected]> wrote: >>>> >>>>> hey , you didn't declare res[] >>>>> >>>>> >>>>> On 17 October 2011 17:47, Vikram Gaur <[email protected]> wrote: >>>>> >>>>>> I used a stub main method to check the code. It is working fine. So >>>>>> the problem must be in how u r calling it. >>>>>> >>>>>> >>>>>> On Mon, Oct 17, 2011 at 9:11 PM, mavrikgaur <[email protected]>wrote: >>>>>> >>>>>>> can you also provide the main method?? >>>>>>> >>>>>>> On Oct 17, 6:58 pm, mandeep <[email protected]> wrote: >>>>>>> > well during submission it's not required. >>>>>>> > and even when i include main() method,still getting the same error. >>>>>>> > >>>>>>> > On Mon, Oct 17, 2011 at 7:25 PM, Swati Lamba <[email protected]> >>>>>>> wrote: >>>>>>> > > where is main() method? >>>>>>> > >>>>>>> > > On 10/17/11, mandy <[email protected]> wrote: >>>>>>> > > > hi there,here is my solution to srm-3,but i am getting >>>>>>> error-(there is >>>>>>> > > > no such method) >>>>>>> > > > So tell me what's wrong with this program. >>>>>>> > >>>>>>> > > > public class Bonuses { >>>>>>> > > > static int i,j,temp,avg=0,sum=0,l=0; >>>>>>> > > > public static int[] getDivison(int[] points) >>>>>>> > > > { >>>>>>> > > > for(l=0;l<points.length;l++) >>>>>>> > > > { >>>>>>> > > > avg+=points[l]; >>>>>>> > > > } >>>>>>> > > > for(j=0;j<points.length;j++) >>>>>>> > > > { >>>>>>> > > > res[j]=points[j]; >>>>>>> > > > res[j]=res[j]*100/avg; >>>>>>> > > > points[j]=res[j]; >>>>>>> > > > sum+=points[j]; >>>>>>> > > > System.out.print(points[j]); >>>>>>> > > > } >>>>>>> > > > System.out.println(sum); >>>>>>> > > > for(i=0;i<points.length;i++) >>>>>>> > >>>>>>> > > > for(j=i+1;j<points.length;j++) >>>>>>> > > > { >>>>>>> > > > if(res[j]>res[i]) >>>>>>> > > > { >>>>>>> > > > temp=res[j]; >>>>>>> > > > res[j]=res[i]; >>>>>>> > > > res[i]=temp; >>>>>>> > > > } >>>>>>> > > > } >>>>>>> > > > for(i=0;i<points.length;i++) >>>>>>> > > > { >>>>>>> > > > for(j=0;j<points.length&&sum!=100;j++) >>>>>>> > > > { >>>>>>> > > > if(res[i]==points[j]) >>>>>>> > > > { >>>>>>> > > > points[j]+=1; >>>>>>> > > > sum++; >>>>>>> > > > } >>>>>>> > > > } >>>>>>> > > > } >>>>>>> > > > return points; >>>>>>> > > > } >>>>>>> > > > } >>>>>>> > >>>>>>> > > > -- >>>>>>> > > > You received this message because you are subscribed to the >>>>>>> Google Groups >>>>>>> > > > "google-codejam" group. >>>>>>> > > > To post to this group, send email to >>>>>>> [email protected]. >>>>>>> > > > To unsubscribe from this group, send email to >>>>>>> > > > [email protected]. >>>>>>> > > > For more options, visit this group at >>>>>>> > > >http://groups.google.com/group/google-code?hl=en. >>>>>>> > >>>>>>> > > -- >>>>>>> > > You received this message because you are subscribed to the >>>>>>> Google Groups >>>>>>> > > "google-codejam" group. >>>>>>> > > To post to this group, send email to >>>>>>> [email protected]. >>>>>>> > > To unsubscribe from this group, send email to >>>>>>> > > [email protected]. >>>>>>> > > For more options, visit this group at >>>>>>> > >http://groups.google.com/group/google-code?hl=en. >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "google-codejam" group. >>>>>>> To post to this group, send email to [email protected]. >>>>>>> To unsubscribe from this group, send email to >>>>>>> [email protected]. >>>>>>> For more options, visit this group at >>>>>>> http://groups.google.com/group/google-code?hl=en. >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Thanks and Regards >>>>>> Vikram Gaur >>>>>> Software Engineer >>>>>> Samsung Engineering Labs, Noida >>>>>> +91-9818540102 >>>>>> >>>>>> "Since human beings themselves are not fully debugged yet, there will >>>>>> be bugs in your code no matter what you do." - Chris Mason >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "google-codejam" group. >>>>>> To post to this group, send email to [email protected]. >>>>>> To unsubscribe from this group, send email to >>>>>> [email protected]. >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/google-code?hl=en. >>>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "google-codejam" group. >>>>> To post to this group, send email to [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> [email protected]. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/google-code?hl=en. >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "google-codejam" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/google-code?hl=en. >>>> >>> >>> >>> >>> -- >>> Thanks and Regards >>> Vikram Gaur >>> Software Engineer >>> Samsung Engineering Labs, Noida >>> +91-9818540102 >>> >>> "Since human beings themselves are not fully debugged yet, there will be >>> bugs in your code no matter what you do." - Chris Mason >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "google-codejam" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/google-code?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "google-codejam" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-code?hl=en. >> > > > > -- > > Thanks & Regards, > *Satyajit Bhadange > Software Programmer* > > *Problems & Solutions* <http://satyajit-algorithms.blogspot.com/> > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
