Changes done as specified :

1. Created object first and then call methods on it.
2. Optimize the code.
3. remove function submitForm() and added method isNumeric.