This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Well, it depends on you how you plug those loop holes that can cause you application to fail, you cannot expect user to enter only definite set of values when there is not restriction. User intentionally or unintentionally can enter any figure, its up to you how you handle it.
In the example mentioned, you can even match whether its a number or not before parsing it.