Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Aluno
- {
- public String Nome { get; set; }
- public String Ra { get; set; }
- public Decimal NotaB1 { get; set; }
- public Decimal NotaB2 { get; set; }
- public Decimal getMedia()
- {
- return (NotaB1 + NotaB2) / 2;
- }
- }
- public class AlunoTecnologo : Aluno
- {
- public Decimal NotaPim { get; set; }
- public Decimal getMedia()
- {
- return NotaPim * 0.2m + base.getMedia();
- }
- }
- public class AlunoDao
- {
- private List<Aluno> alunos;
- public AlunoDao()
- {
- alunos = new List<Aluno>();
- }
- public void Adicionar(Aluno aluno)
- {
- alunos.Add(aluno);
- }
- public List<Aluno> Listar()
- {
- return new List<Aluno>(alunos);
- }
- }
- static void Main(string[] args)
- {
- Aluno vizu = new Aluno()
- {
- Nome = "Joao Vizu",
- Ra = "N300361",
- NotaB1 = 7.5M,
- NotaB2 = 10M
- };
- AlunoTecnologo lais = new AlunoTecnologo()
- {
- Nome = "Lais Silva",
- Ra = "545454",
- NotaB1 = 7.5M,
- NotaB2 = 10M,
- NotaPim = 9M
- };
- AlunoDao dao = new AlunoDao();
- dao.Adicionar(vizu);
- dao.Adicionar(lais);
- foreach (Aluno aluno in dao.Listar())
- {
- Console.WriteLine($"Nome: {aluno.Nome}tNotaB1: {aluno.NotaB1}tNotaB2: {aluno.NotaB2}tMedia: {aluno.getMedia()}");
- }
- Console.ReadKey();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement