public void adicionar(Programa p) { string auxNombrePrograma = p.getNombre(); this.programas[0, this.nroProgramas] = auxNombrePrograma; this.programas[1, this.nroProgramas] = "no"; this.programas[2, this.nroProgramas] = "03/10/2020"; this.programas[3, this.nroProgramas] = "250"; this.nroProgramas = this.nroProgramas + 1; }
public void mostrar(Programa p) { int auxAnioPrograma = p.getAnio(); int contador = 0; for (int j = 0; j < this.nroProgramas; j++) { string auxAnioString = this.programas[2, j].Substring(6); int auxAnioInt = Int32.Parse(auxAnioString); if (auxAnioInt == auxAnioPrograma) { Console.WriteLine(this.programas[0, j]); Console.WriteLine(this.programas[1, j]); Console.WriteLine(this.programas[2, j]); Console.WriteLine(this.programas[3, j]); Console.WriteLine(); contador = contador + 1; } } Console.WriteLine("Se encontraron " + contador + " programas con el mismo año"); }