Chinedu: Here are a couple of points to help you get started. You can read a string from the keyboard using the following sequence
To convert the string into an integer, you can use this code:
Notice that you have to catch and handle NumberFormatException, which is thrown if the string being converted into an integer does not contain a valid integer value. One other point, although it is common in example programs to simply throw IOException out of main(), as you code does, you could also handle it inside main() by using a try/catch block similar to that required by Integer.parseInt().
If you are still having problems, let us know.
For my latest books on Java, including my Java Programming Cookbook, see HerbSchildt.com