Originally posted by Peter Kolozvary: ...salaries = keyboard.nextInt(); ...
Scanner's nextInt() method will throw an exception if the next token cannot be parsed as an int, so you will need to validate before calling that.
Hint: Check Scanner's other methods in the API to see if there's a method that will check to see if the next token is an int.
Also, how much validation do you want/need to do here? For example, what if the user enters a dollar sign? Or misplaced commas? Or a decimal point? Or extra spaces? In those cases, you might be better off reading the input as a String, and then removing any character that is not a digit. (For that approach, see the Character class.) [ October 21, 2008: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org