Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package clubenauticotp1;
- /**
- *
- * @author joaoa
- */
- public class Menor extends Jovem {
- private double desconto = 0.2;
- private int contaMenor = 0;
- private String educacao;
- private static final String EDUCACAO_POR_OMISSAO = "";
- private static final String PREFIXO_POR_OMISSAO = "SMenor-";
- public Menor() {
- super();
- this.educacao = EDUCACAO_POR_OMISSAO;
- }
- public Menor(String nome, int contribuinte, int ano, int nAulas, String educacao) {
- super(nome, contribuinte, ano, nAulas);
- this.educacao = educacao;
- }
- /**
- * @return the desconto
- */
- public double getDesconto() {
- return desconto;
- }
- /**
- * @param desconto the desconto to set
- */
- public void setDesconto(double desconto) {
- this.desconto = desconto;
- }
- /**
- * @return the educacao
- */
- public String getEducacao() {
- return educacao;
- }
- @Override
- public String getAbreviatura() {
- return String.format("SMenor +- %d", contaMenor++);
- }
- @Override
- public double CalcularMensalidade() {
- double total = getDesconto() * getNAulas() * 4 * getValorAulas();
- if (total > 100) {
- return 100;
- } else {
- return total;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement