public void findHighestNumber(int timesToLoop)
{
int highNumber = 0;
int counter = 0;
int userInput = 0;
while(counter < timesToLoop) {
System.out.print("Enter a whole number: ");
userInput = reader.getInput();
counter++;
System.out.println("");
}
if(userInput > highNumber) {
highNumber = userInput;
}
if(counter == timesToLoop) {
System.out.println("Finished looping! Highest is " +highNumber);
System.out.println("");
}
if(counter > timesToLoop) {
System.out.println("You have entered a negative number: " +timesToLoop);
System.out.println("");
}
}
How do I track the highest number? I can't figure this out.