Spoiler
public class Ch_05_01_ControlStructures {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] sales2014 = {500,720,515,377,400,435,510,1010,894,765,992,1125};
int[] staff2014 = {7,5,5,5,5,6,6,7,7,8,9,9};
int[] salesPerStaff = new int[12]; // I will very likely delete this.
// Ch_05_01_ControlStructures Pass1 = new Ch_05_01_ControlStructures();
avgSalesStaff(sales2014, staff2014); // Error: Cannot make a static reference to the non-static method avgSalesStaff(int[], int[]) from the type Ch_05_01_ControlStructures
}
void avgSalesStaff (int[] sales, int[] staff) {
int totalSales2014 = 0;
for (int i=0; i< sales.length; i++) {
sales[i] = sales[i]/staff[i];
totalSales2014 += sales[i];
System.out.println("Total 2014 sales: " + totalSales2014);
}
}
}
The other examples I came only deals with passing a single array argument.

New Topic/Question
Reply


MultiQuote




|