Boa noite,
Vá, bem que poderias ter lido o código com atenção!
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace ConsoleApplication1
{
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, 18);
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, 8);
turma.Add(estundante);
//imprime cabecalho
System.Console.WriteLine("╔═════════════════════════════════╦═══════════╦══════════╦═══════════════════════╦══════════════════════════════╗");
System.Console.WriteLine("║ Nome ║ Teste 1 ║ Teste 2 ║ Classificação Final ║ Situação ║");
System.Console.WriteLine("╠═════════════════════════════════╬═══════════╬══════════╬═══════════════════════╬══════════════════════════════╣");
string situacao;
string spaceAux = " ";
foreach (EstudanteInf est in turma)
{
int spaceNome = (33-(est.lerNome().Length));
//blah blah blah wiskas saquetas e lê o código para fazeres os restantes
string toPrint = "║" + est.lerNome() + spaceAux.PadRight(spaceNome) + "║" + est.lerTeste1() + "║" + est.lerTeste2() + "║" + est.classFinal() + "║";
if (est.classFinal() >= 10) //bastava ler
{
situacao = "aprovado"; //ai se eu me desse ao trabalho de ler... teria reparado no sinal de igual que estava a mais!
}
else { situacao = "reprovado"; } //ai se eu me desse ao trabalho de ler... teria reparado no sinal de igual que estava a mais!
System.Console.WriteLine(toPrint);
}
//imprime a ultima linha
System.Console.WriteLine("╚═════════════════════════════════╩═══════════╩══════════╩═══════════════════════╩══════════════════════════════╝");
System.Console.Read();
foreach (EstudanteInf value in turma)
{
if (value.situacaoDoAluno().Equals("Aprovado"))
{
value.imprimir();
}
}
}
}
}
Cordiais cumprimentos,
Apocsantos
↧