How to return person with max sales in salesperson program- JAVA [PT. 2]
<p>Sorry if I'm being bothersome. But I am stuck on another part of my HW problem. I am now tasked at instead of having an salesperson 0, salespersons start with 1. I have tried to solve this by parsing the strings i to an integer and adding 1. Seemed like it would work. However, for some reason the calculating of min is not correct. It stays at 0. I've tried stepping through the code and seeing why, but I cannot see it.</p>

<pre><code>import java.util.Scanner;
public class Cray {
public static void main(String[] args){

    final int SALESPEOPLE = 5;
    int[] sales = new int[SALESPEOPLE];
    int sum, randomValue, numGreater = 0;
    int max = sales[0];
    int min = sales[0];
    int maxperson = 0;
    int minperson = 0;



    Scanner scan = new Scanner(System.in);
    for (int i=0; i&lt;sales.length; i++)
        {
        //To attempt print out the information of salesperson 0 and salesperson 1, I returned the integer value of i and added one.
        System.out.print("Enter sales for salesperson " + Integer.valueOf(i+1) + ": ");
        sales[i] = scan.nextInt();

        //max if statemnent works fine and is correct
        if(sales[i] &gt; max){
            max= sales[i];
            maxperson = i;
        }
        //For some reason max is calculating but not min. 
        if(sales[i] &lt; min){
            min = sales [i];
            minperson= i;
        }


        }



    System.out.println("\nSalesperson   Sales");
    System.out.println("--------------------");
    sum = 0;
    for (int i=0; i&lt;sales.length; i++)
        {
        System.out.println("     " + Integer.valueOf(i+1) + "         " + sales[i]);
        sum += sales[i];
        }

    System.out.println("\nTotal sales: " + sum);
    System.out.println("Average sales: " + sum/5);
    System.out.println();
    System.out.println("Salesperson " + Integer.valueOf(maxperson+1) + " had the most sales with " + max );
    System.out.println("Salesperson " + Integer.valueOf(minperson+1) + " had the least sales with " + min);
    System.out.println();
    System.out.println("Enter any value to compare to the sales team: ");
    randomValue = scan.nextInt();
    System.out.println();
    for(int r=0; r &lt; sales.length; r++){
        if(sales[r] &gt; randomValue){
            numGreater++;
            System.out.println("Salesperson " + Integer.valueOf(r+1) + " exceeded that amount with " + sales[r]);
        }

    }
    System.out.println();
    System.out.println("In total, " + numGreater + " people exceeded that value");

      }

    }
</code></pre>
