const curso = {
titulo: "JavaScript Intermediário",
estudantes: [
{ nome: "Ana", progresso: 85 },
{ nome: "Carlos", progresso: 40 },
{ nome: "Juliana", progresso: 72 },
{ nome: "Pedro", progresso: 60 }
],
gerarRelatorio: function gerarRelatorio() {
let progressoTotal = 0;
const totalEstudantes = this.estudantes.length;
for (const estudante of this.estudantes) {
const {nome, progresso} = estudante
let situacao = 'Em andamento';
progressoTotal += progresso;
if (progresso >= 70) {
situacao = 'Aprovado';
}
console.log(`Estudante: ${nome} | Progresso: ${progresso}% | Situação: ${situacao}`);
}
console.log(`Total de estudantes: ${totalEstudantes}`);
console.log(`Média geral da turma: ${(progressoTotal / totalEstudantes).toFixed(2)}%`);
}
};
curso.gerarRelatorio();