// return the average of all sales public double avgSales() { double total = 0.0; for (SalesPerson p : salesmen) { total += p.getSales(); } return total / salesmen.length; }
// display a report of the highest selling salesperson, the average sales and the above average // sales people public void displayReport() { SalesPerson highest = highestSales(); System.out.println("The highest sales were from: " + highest.getName()); System.out.println("The average sales were: " + avgSales()); // print out a list of the sales people that were above average System.out.println("The following sales people were above average:"); for (SalesPerson p : salesmen) { if (p.getSales() > avgSales()) { System.out.println(p.getName()); } } }