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.

Reply via email to