-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdio26-Classe-Curso.cs
44 lines (35 loc) · 1.08 KB
/
dio26-Classe-Curso.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ExemplosExplorando.Models
{
public class Curso
{
public string Nome { get; set; }
public List<Pessoa> Alunos { get; set; }
public void AdicionarAluno(Pessoa aluno)
{
Alunos.Add(aluno);
}
public int ObterQuantidadeDeAlunosMatriculados()
{
int quantidade = Alunos.Count;
return quantidade;
}
public bool RemoverAluno(Pessoa aluno)
{
return Alunos.Remove(aluno);
}
public void ListarAlunos()
{
Console.WriteLine($"Alunos do Curso de : {Nome}");
for (int count = 0; count < Alunos.Count; count++)
{
//string texto = "N° " + count + " - " + Alunos[count].NomeCompleto;
string texto = $"N° {count + 1} - {Alunos[count].NomeCompleto}";
Console.WriteLine(texto);
}
}
}
}