Skip to content
View Randerson-Abdon's full-sized avatar
  • Arco Tech
  • Brasil-Belém-PA

Highlights

  • Pro

Organizations

@arcotech-services

Block or report Randerson-Abdon

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
Randerson-Abdon/README.md

class Aluno { public String n; public double nt; public boolean bolsista;

public Aluno(String n, double nt, boolean bolsista) {
    this.n = n;
    this.nt = nt;
    this.bolsista = bolsista;
}

}

class AlunoBolsista extends Aluno { public double bolsa;

public AlunoBolsista(String n, double nt) {
    super(n, nt, true);
    this.bolsa = 1000.0;
}

@Override
public String toString() {
    return n + " - Bolsa: R$" + bolsa;
}

}

interface Repositorio { void salvar(Aluno a); void deletar(int id); List buscarTodos(); }

class RepositorioAluno implements Repositorio { private List lista = new ArrayList<>();

public void salvar(Aluno a) {
    lista.add(a);
}

public void deletar(int id) {
    lista.remove(id);
}

public List<Aluno> buscarTodos() {
    return lista;
}

}

class AlunoService { private RepositorioAluno repo = new RepositorioAluno();

public void cadastrar(String n, double nt, boolean bolsista) {
    Aluno a = new Aluno(n, nt, bolsista);
    repo.salvar(a);
}

public void calcularMedia() {
    double soma = 0;
    for (Aluno a : repo.buscarTodos()) {
        soma += a.nt;
    }
    System.out.println("Média geral: " + (soma / repo.buscarTodos().size()));
}

public void notificarAlunos() {
    for (Aluno a : repo.buscarTodos()) {
        if (a.nt < 6.0) {
            System.out.println("Aluno " + a.n + " REPROVADO.");
        } else {
            System.out.println("Aluno " + a.n + " APROVADO.");
        }
    }
}

}

public class Main { public static void main(String[] args) { AlunoService service = new AlunoService(); service.cadastrar("Ana", 8.5, false); service.cadastrar("Carlos", 4.0, false); service.cadastrar("Lucas", 7.2, true);

    service.calcularMedia();
    service.notificarAlunos();
}

}

Popular repositories Loading

  1. modelo_listagem modelo_listagem Public

    Modelo de retorno de listagem com HTML5, PHP e Mysqli

    PHP 4

  2. bot-zap-nodejs-express-php bot-zap-nodejs-express-php Public

    PHP 1

  3. Randerson-Abdon Randerson-Abdon Public

    Config files for my GitHub profile.

  4. aula-git aula-git Public

    HTML

  5. Boleto-Flow Boleto-Flow Public

    Projeto de App em Flutter para gerenciamento de boletos

    Dart

  6. saae-cameta saae-cameta Public

    Projeto SAAENET de Cametá

    PHP