> Help WIth Testing Basic Java Program?

Help WIth Testing Basic Java Program?

Posted at: 2014-12-18 
You basically have it:

int [] input = {5, 7, 10, 1, 23, 14, 123, 42};

But then you need a loop

for (int i=0; i
int income = input [i];

if (income<10000) band = 0.04;

}

Im pretty new to programming. I have written a program that takes the users income as a user input [from Scanner], uses an if statement to work out their tax band and then calculates income after tax. That all works well whilst the user is inputing the incomes, but to test the program i have been given a predefined set of values to use as input.

Is their a way of taking this data set and making the program automatically run for each value of the data set rather than inputing each of the values individually?

I was told it might be something about arrays if thats useful :)

Added Info:

Currently the program uses:

Scanner keyboard = new Scanner (System.in);

int income = keyboard.nextInt();

I need:

int income = (values from the set: {25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 425, 450, 500, 550})

Thanks to anyone who can help :)