Advertisement
vinidj

Cliente - classe básica e exceções

Jun 13th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. package Cliente;
  2.  
  3. public class Cliente {
  4. private String CPF;
  5. private Integer Nivel;
  6. public Cliente (String cpf) {
  7. this.CPF = cpf;
  8. this.Nivel = null;
  9. }
  10. public String getCPF() {
  11. return this.CPF;
  12. }
  13. public Integer getNivel() {
  14. return this.Nivel;
  15. }
  16. public void setNivel(Integer nivel) {
  17. this.Nivel = nivel;
  18. }
  19. }
  20.  
  21. package Cliente;
  22.  
  23. public class CPFInvalidoException extends Exception{
  24. private String CPF;
  25. public CPFInvalidoException (String cpf) {
  26. super ("O CPF" + cpf + "é invalido");
  27. this.CPF = cpf;
  28. }
  29. }
  30.  
  31. package Cliente;
  32.  
  33. public class NivelNaoDefinidoException extends Exception {
  34. private String CPF;
  35. public NivelNaoDefinidoException (String cpf) {
  36. super ("Nivel não definido para o cliente" + cpf);
  37. this.CPF = cpf;
  38. }
  39. }
  40.  
  41. package Cliente;
  42.  
  43. public class NivelInvalidoException extends Exception {
  44. public NivelInvalidoException () {
  45. super ("Nivel inserido invalido./nInsira 1 para o plano de 5% de desconto./nInsira 2 para o plano de 10% de desconto./nInsira 3 para o plano de 15% de desconto.");
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement