Boa tarde estou aqui com um problema em meter este programa funcionar o programa tem de imprimir dez alunos com resultado do teste 1 e teste 2 e a media dois testes .
Também preciso de ajuda a fazer uma tabela onde tem aparecer escrito em cima dos nome dos alunos e as notas deles ,Nome do Aluno ,nota do teste1,nota do teste 2 , classificação final.
Se me alguém puder ajudar ficaria muito grato Precisava mesmo de ajuda Se pudessem dar exemplos de como fazer uma tabela também era uma boa ajuda mas o principal era conseguir meter este programa a funcionar .
Class Program .
using System.Collections;
namespace ex1
{
class Program
{
static void Main(string[] args)
{
ArrayList turma = new ArrayList();
EstudanteInf estundante = new EstudanteInf("joao Ramos", 20, 15);
turma.Add(estundante);
estundante = new EstudanteInf("tiago", 15, 16);
turma.Add(estundante);
estundante = new EstudanteInf("andre", 13, 13);
turma.Add(estundante);
estundante = new EstudanteInf("pedro", 13, 13);
turma.Add(estundante);
estundante = new EstudanteInf("diogo", 13, 15);
turma.Add(estundante);
estundante = new EstudanteInf("goncalo", 13, 16);
turma.Add(estundante);
estundante = new EstudanteInf("bruno", 13, 17);
turma.Add(estundante);
estundante = new EstudanteInf("francisco", 13, 18);
turma.Add(estundante);
estundante = new EstudanteInf("andre", 13, 19);
turma.Add(estundante);
estundante = new EstudanteInf("pascoal", 8, 3);
turma.Add(estundante);
estundante = new EstudanteInf("afonso", 9, 5);
turma.Add(estundante);
foreach (EstudanteInf value in turma)
{
if (value.situacaoDoAluno().Equals("Aprovado"))
{
value.imprimir();
}
}
System.Console.WriteLine();
System.Console.Read();
}
}
}
Class EstudanteInf
using System;
namespace ex1
{
class EstudanteInf
{
string Nome;
Double Teste1;
Double Teste2;
private string p;
public EstudanteInf(string NomeDoAluno, Double NotaTeste1, Double NotaTeste2)
{
Nome = NomeDoAluno;
Teste1 = NotaTeste1;
Teste2 = NotaTeste2;
}
public EstudanteInf(string p)
{
// TODO: Complete member initialization
this.p = p;
}
public Double classFinal()
{
Double media = (Teste1 + Teste2) / 2;
return media;
}
public string lerNome()
{
return Nome;
}
public void escreveNome(string NomeDoAluno)
{
Nome = NomeDoAluno;
}
public void escrevenotaTeste1(Double notaTeste1)
{
Teste1 = notaTeste1;
}
public void escrevenotaTeste2(Double notaTeste2)
{
Teste2 = notaTeste2;
}
public void imprimir(Double classificacaoFinal)
{
System.Console.WriteLine("| " + lerNome() + " | " + Teste1 + " | " + Teste2 + " | " + classFinal());
}
public string situacaoDoAluno()
{
double classificacaoFinal = classFinal();
if (classificacaoFinal >= 10)
{
return "Aprovado";
}
else
{
if (classificacaoFinal >= 8)
return "Admitido a oral";
else
{
return "reprovado";
}
}
}
internal void imprimir()
{
throw new NotImplementedException();
}
}
}
↧