0

I am trying to create a method that will step through an array with a for loop and if they array subscript is greater than or equal to the minimum requirement a string array subscript will be added to a listbox.

Here is my feeble attempt, along with the method I've tried below it. When calling the method AwardMinimum, the whole thing is incorrect stating, "has some invalid arguments". Commented out is what every level looks like. (level <=10, level >10 && <=20, etc..)

            if (level <= 10)
            {
                AwardMinimum(perDayArray, min, awardsArray);
                /*for (int i = 0; i < STATSIZE; i++)
                {
                    if (perDayArray[i] >= 2)
                    {
                        awardListBox.Items.Add(awardsArray[i]);
                    }
                }*/
            }

The method itself

    private void AwardMinimum(double perDay, int min, string awards)
    {
        for (int i = 0; i < STATSIZE; i++)
        {
            if (perDay >= min)
            {
                awardListBox.Items.Add(awards);
            }
        }
    }
1
  • 1
    Where do perDayArray, min, and awardsArray come from and what are their types? Commented Apr 19, 2016 at 22:02

1 Answer 1

1

perDayArray and awardsArray are array but in the AwardMinimum(double perDay, int min, string awards) method you use them as double and string.

it should be :

private void AwardMinimum(double[] perDay, int min, string[] awards)

or

AwardMinimum(perDayArray[i], min, awardsArray[i]); //where i is the index
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.