title: How do I create a counter to count the number of people who had the maximum salary entered?
body: <pre><code>import java.util.Scanner;
  
  public class Lab4a{
    public static void main(String[] args){
    Scanner keyboard = new Scanner(System.in);
    int numemployees, max, freq;
  
    System.out.print("Enter number of employees: ");
    numemployees = keyboard.nextInt();
  
    System.out.println("Enter salary for " + numemployees + " employees:");
    int[] salaries = new int [numemployees];
  
    max = salaries[0];
    for (int i=0; i &lt; salaries.length; i++){
      salaries[i] = keyboard.nextInt();
      if (salaries[i] &gt; max)
        max = salaries[i];
    }
  
    System.out.println("Maximum salary is " + max);
    System.out.println(" employees received " + max);
  }
  </code></pre>
  
  <p>So the output for this would be</p>
  
  <p>Enter number of employees: 3
  Enter salary for 3 employees:
  10000
  15000
  15000
  Maximum salary is 15000
    employees received 15000</p>
  
  <p>I WANT IT TO SAY, "2 employees received 15000".  That's all I need for it to do. Please help me how to establish that counter using another loop... as simple as possible! Thanks!</p>