Quantcast
Channel: Tópicos
Viewing all articles
Browse latest Browse all 11336

Imprimir dados

$
0
0
Bom dia, Depois de ver o código apenas se me ocorreu que não chegas-te a ler o que te foi dito no outro post. Basta contares os espaços entre entre o texto a ser impresso e a grelha, para preencheres os campos correctamente. Não é nada do outro mundo! Fica aqui a resposta à questão dos aprovados. ~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; foreach (EstudanteInf est in turma) { string toPrint = "║" + est.lerNome() + "║" + est.lerTeste1() + "║" + est.lerTeste2() + "║" + est.classFinal() + "║"; if (value.classFinal() >= 10) { situacao == "aprovado"; } else { situacao == "reprovado";} 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

Viewing all articles
Browse latest Browse all 11336

Trending Articles