Counting
This may be a really simple question, but I cant figure it out for the life of me. at the end of the program after I ask the user to enter a value and then I print the salesmen who have sold hire than that amount. I am supposed to put a count and print it on how many did. Right now I have the list set up and the whole program works I just need some help with the count of that. Can anyone help?
// ****************************************************************
// Sales.javaAuthor: Kehr,John
//
// Reads in and stores sales for each of 5 salespeople. Displays
// sales entered by salesperson id and total sales for all salespeople.
//
// ****************************************************************
import java.util.Scanner;
publicclass Sales
{
publicstaticvoid main(String[] args)
{
int sum, average, max, min, uservalue, total, salespeople, SALESPEOPLE;
Scanner scan =new Scanner(System.in);
System.out.println("How many salespeople; ");
salespeople = scan.nextInt();
SALESPEOPLE = salespeople;
int[] sales =newint[SALESPEOPLE];
for (int i=0; i<sales.length; i++)
{
System.out.print("Enter sales for salesperson " + (i+1) +": ");
sales[i] = scan.nextInt();
}
System.out.println("\nSalespersonSales");
System.out.println("--");
sum = 0;
max = sales[0];
min = sales[0];
for (int i=0; i><sales.length; i++)
{
System.out.println("" + (i+1) +" " + sales[i]);
sum += sales[i];
if (sales[i] > max)
{
max = sales[i];
}
if (min > sales[i])
{
min = sales[i];
}
}
System.out.println("\nTotal sales: " + sum);
average = sum/SALESPEOPLE;
System.out.println("\nAverage sales: " + average);
System.out.println("\nMaximum sale: " + max);
System.out.println("\nMinimum sale: " + min);
System.out.println("\nPlease enter a value: ");
uservalue = scan.nextInt();
total = 0;
System.out.println("These salesman have exceeded sales entered");
System.out.println("\nSalespersonSales");
for (int i=0; i<sales.length; i++)
{
if (sales[i] > uservalue)
{
System.out.println("" + (i+1) +" " + sales[i]);
}
}
}
}

