Advertisement
IvaAnd

Validator

Nov 8th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. package FootbalTeamGenerator;
  2.  
  3. public class Validator {
  4.  
  5. public static boolean statIsValid(int stat){
  6.  
  7. if (stat < 0 || stat > 100){
  8. throw new IllegalArgumentException(" should be between 0 and 100.");
  9. }
  10. return true;
  11. }
  12.  
  13. public static boolean nameIsValid(String name){
  14.  
  15. if (name.trim()==null || name.trim().isEmpty()){
  16. throw new IllegalArgumentException
  17. ("A name should not be empty.");
  18. }
  19. return true;
  20. }
  21.  
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement