Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package clubenauticotp1;
  7.  
  8. /**
  9. *
  10. * @author joaoa
  11. */
  12. public class Menor extends Jovem {
  13.  
  14. private double desconto = 0.2;
  15. private int contaMenor = 0;
  16. private String educacao;
  17.  
  18. private static final String EDUCACAO_POR_OMISSAO = "";
  19. private static final String PREFIXO_POR_OMISSAO = "SMenor-";
  20.  
  21. public Menor() {
  22. super();
  23. this.educacao = EDUCACAO_POR_OMISSAO;
  24. }
  25.  
  26. public Menor(String nome, int contribuinte, int ano, int nAulas, String educacao) {
  27. super(nome, contribuinte, ano, nAulas);
  28. this.educacao = educacao;
  29. }
  30.  
  31. /**
  32. * @return the desconto
  33. */
  34. public double getDesconto() {
  35. return desconto;
  36. }
  37.  
  38. /**
  39. * @param desconto the desconto to set
  40. */
  41. public void setDesconto(double desconto) {
  42. this.desconto = desconto;
  43. }
  44.  
  45. /**
  46. * @return the educacao
  47. */
  48.  
  49. public String getEducacao() {
  50. return educacao;
  51. }
  52.  
  53. @Override
  54. public String getAbreviatura() {
  55. return String.format("SMenor +- %d", contaMenor++);
  56. }
  57.  
  58. @Override
  59. public double CalcularMensalidade() {
  60. double total = getDesconto() * getNAulas() * 4 * getValorAulas();
  61. if (total > 100) {
  62. return 100;
  63. } else {
  64. return total;
  65. }
  66. }
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement