package club.udodov.mai.calculon; /** * Created by stud on 08.12.2015. */ public class Calculon { public int validate (String param) throws Exception{ int num; //String param = request.getParameter("number"); String err = ""; if (param == null){ param="10"; } try { num = Integer.parseInt(param); if (num == 0) { throw new Exception("insert null"); }else if (num < 0) { throw new Exception("too little"); //num = 0; }else if (num > 100){ throw new Exception("too many"); //num = 100; } } catch (NumberFormatException er){ //num = 0; throw new Exception("wrong format"); } return num; } }