Need help finalizing program, I'm able to display the highest points and during what game but it's not working for the lowest score and game.

        int max = 1;
        int min = 1;
        int highestGame = 1;
        int lowestGame = 1;

        Scanner input = new Scanner(System.in);
        System.out.println("Enter Texan's First 8 Regular Season Points Per Game");
        System.out.println("----------------------------------------------------");

        for (int currentGame = 1; currentGame <= 8; currentGame++)
        {
            System.out.print("Points For Game " + currentGame + ": ");
            int points = input.nextInt();

            if (points > max)
            {
                max = points;
                highestGame = currentGame;
            }
            if (points > min)
            {
                min = points;
                if (min < max)
                {
                    min = min;
                    lowestGame = currentGame;
                }
            }
        }

        System.out.println("Highest Points Scored Was " + max + " In Game " + highestGame);
        System.out.println("Lowest Points Scored Was " + min + " In Game " + lowestGame);
    }
}

no offence, but your code doesn't make much sense. for instance:

if (min < max)
{
min = min;
lowestGame = currentGame;
}

min = min; ? talking about a redundant line of code here.
next basic problem:

if (points > min)
{
min = points;

this should be:
if ( points < min)

next issue:

int max = 1;
int min = 1;

these are bad chosen values. for instance: what 'll happen in your code if the lowest score was 2? then your result would amount to be 1, even though that is not a score you've gotten.

let's assume your game has a possible points range from 0 to 10, then the default values would be better chosen as:

int max = -1;
int min = 11;

this way, any value obtained, even the extremes (0 and 10) will change those values correctly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.