added error checking/handling for get Square method
added try catch block to throw exception