banner2

Home Foros Foro dudas Foro de Java Ejercicio POO video 47-B (Colegios y alumnos)

Ejercicio POO video 47-B (Colegios y alumnos)

Este debate contiene 2 respuestas, tiene 2 mensajes y lo actualizó  Fran hace 3 semanas, 1 día.

Viendo 3 publicaciones - del 1 al 3 (de un total de 3)
  • Autor
    Publicaciones
  • #9836

    Fran
    Participante

    Hola,

    es la primera vez que posteo aquí. Estoy haciendo el curso tutorizado de Java y acabo de “resolver” el ejercicio planteado por Juan. No sé si éste es el mejor sitio donde colgar el resultado pero aquí lo dejo. Al ejecutarlo parece que funciona bien.

    Comentar que, no sé si os ha pasado, pero me ha resultado muy costoso solucionarlo, entre otras cosas porque tengo la sensación de que este ejercicio debería haberse planteado unas lecciones más adelante, al incluir conceptos que se ven en los vídeos  siguientes (igual me equivoco). Dado que he empezado a programar casi de cero, veo que me está costando. Hasta ahora mi único contacto con la programación había sido BASIC, COBOL y Fortran… y hablo de la década de los ’80 con mi viejo Amstrad CPC464 :-p …y principios de los ’90, con lo que aprender la sintaxis básica (condicionales, bucles y matrices) no me ha costado, pero la POO de momento es un hueso…

    No me enrollo más. Si creéis que hay algún fallo gordo, agradecería algún comentario.

    P.D.: no sé cómo lograr que se imprima con el mismo aspecto que en Eclipse, en lugar de mostrar un texto tan plano. Sorry.

     
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>package</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> ejercicioColegios;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>class</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> UsoColegio {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>static</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>void</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> main(String[] </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>args</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #3f7f5f;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>// </span></span></span><span style=”color: #7f9fbf;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>TODO</b></span></span></span><span style=”color: #3f7f5f;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Auto-generated method stub</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Colegio </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>AusiasMarch</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=</span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>new</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Colegio (</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Ausiàs March”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, 100);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Colegio </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>CintoVerdaguer</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=</span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>new</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Colegio(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Mossèn Cinto Verdaguer”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, 180);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>AusiasMarch</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.setNuevoAlumno(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Pepe”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, 6.1);;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>AusiasMarch</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.setNuevoAlumno(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Ana”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, 8.2);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>AusiasMarch</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.setNuevoAlumno(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Vero”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, 5.1);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>CintoVerdaguer</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.setNuevoAlumno(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Xavi”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, 6.2);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>CintoVerdaguer</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.setNuevoAlumno(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Iu”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, 8.6);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>AusiasMarch</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.setNuevoAlumno(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Erika”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, 9.0);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>CintoVerdaguer</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.setNuevoAlumno(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Roberto”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, 4.7);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>CintoVerdaguer</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.setNuevoAlumno(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Nerea”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, 6.5);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>AusiasMarch</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.getTodosAlumnos();</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>CintoVerdaguer</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.getTodosAlumnos();</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>CintoVerdaguer</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.setNotaMedia(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Roberto”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, 7);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>CintoVerdaguer</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.getDatosAlumno(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Roberto”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>AusiasMarch</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.expulsaAlumno(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Vero”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>AusiasMarch</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.getTodosAlumnos();</span></span></span></p>
     

     

     
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>package</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> ejercicioColegios;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>class</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Colegio {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Colegio (String </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreColegio</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, </span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>int</b></span></span></span> <span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>capacidad</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>this</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreColegio</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreColegio</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>MatrizAlumnos</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=</span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>new</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Alumno[</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>capacidad</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>];</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> String getNombreColegio() {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>return</b></span></span></span> <span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreColegio</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>void</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> setNuevoAlumno(String </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, </span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>double</b></span></span></span> <span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>notaMedia</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>) {</span></span></span><span style=”color: #3f7f5f;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>//</span></span></span><span style=”color: #3f7f5f;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><u>almacena</u></span></span></span> <span style=”color: #3f7f5f;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><u>alumnos</u></span></span></span> <span style=”color: #3f7f5f;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><u>en</u></span></span></span> <span style=”color: #3f7f5f;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><u>la</u></span></span></span> <span style=”color: #3f7f5f;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><u>matriz</u></span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Alumno </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nuevoAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=</span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>new</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Alumno(</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, </span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>this</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>notaMedia</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>MatrizAlumnos</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>[</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>contador</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>]=</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nuevoAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>contador</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>++; </span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>void</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> getTodosAlumnos() {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>for</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> (</span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>int</b></span></span></span> <span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=0; </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>contador</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>; </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>++) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> System.</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><i><b>out</b></i></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.println(</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>MatrizAlumnos</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>[</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>].getImprimeDatosAlumno());</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> System.</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><i><b>out</b></i></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.println(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”—————“</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>void</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> getDatosAlumno(String </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>for</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> (</span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>int</b></span></span></span> <span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=0; </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>contador</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>; </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>++) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>if</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> (</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>MatrizAlumnos</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>[</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>].getNombreAlumno().equalsIgnoreCase(</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>)) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> System.</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><i><b>out</b></i></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.println(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”+++++++++++++”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>); </span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> System.</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><i><b>out</b></i></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.println(</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>MatrizAlumnos</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>[</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>].getImprimeDatosAlumno());</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> System.</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><i><b>out</b></i></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.println(</span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”+++++++++++++”</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>); </span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>void</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> setNotaMedia(String </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, </span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>double</b></span></span></span> <span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>notaMedia</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>for</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> (</span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>int</b></span></span></span> <span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=0; </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>contador</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>; </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>++) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>if</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> (</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>MatrizAlumnos</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>[</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>].getNombreAlumno().equalsIgnoreCase(</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>)) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Alumno </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>cambioNota</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=</span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>new</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Alumno(</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, </span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>this</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>notaMedia</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>);</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>MatrizAlumnos</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>[</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>]=</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>cambioNota</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>void</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> expulsaAlumno(String </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>for</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> (</span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>int</b></span></span></span> <span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=0; </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>contador</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>; </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>++) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>if</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> (</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>MatrizAlumnos</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>[</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>].getNombreAlumno().equalsIgnoreCase(</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>)) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>for</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> (</span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>int</b></span></span></span> <span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>j</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>i</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>; </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>j</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>contador</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>; </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>j</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>++) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>MatrizAlumnos</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>[</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>j</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>]=</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>MatrizAlumnos</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>[</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>j</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>+1];</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> } </span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>contador</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>-=1;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>final</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> String </span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreColegio</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>private</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Alumno </span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>MatrizAlumnos</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>[];</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>private</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>int</b></span></span></span> <span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>contador</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>package</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> ejercicioColegios;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>class</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Alumno {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Alumno(String </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, Colegio </span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreColegio</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>, </span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>double</b></span></span></span> <span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>notaMedia</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>) {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>this</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>this</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreColegio</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreColegio</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>this</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>notaMedia</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=</span></span></span><span style=”color: #6a3e3e;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>notaMedia</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>; </span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>Identificacion</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><i>Id</i></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><i>Id</i></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>++; </span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> String getNombreAlumno() {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>return</b></span></span></span> <span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>double</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> getNotaMedia () {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>return</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>this</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>notaMedia</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> String getColegioAlumno() {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>return</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>this</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreColegio</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.getNombreColegio();</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>public</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> String getImprimeDatosAlumno() {</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> System.</span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><i><b>out</b></i></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.println();</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>return</b></span></span></span> <span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”Nombre alumno: “</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> + </span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> + </span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”\nColegio: “</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> + </span></span></span><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>this</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>.getColegioAlumno() </span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> + </span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”\nNº alumno: “</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> + </span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>Identificacion</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> + </span></span></span><span style=”color: #2a00ff;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>”\nNota media: “</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> + </span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>notaMedia</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>; </span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> }</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>private</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>final</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> String </span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreAlumno</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>private</b></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”> Colegio </span></span></span><span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>nombreColegio</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>private</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>double</b></span></span></span> <span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>notaMedia</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>private</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>int</b></span></span></span> <span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>Identificacion</span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>;</span></span></span></p>
    <p style=”margin-bottom: 0cm; line-height: 100%;” align=”left”><span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>private</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>static</b></span></span></span> <span style=”color: #7f0055;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><b>int</b></span></span></span> <span style=”color: #0000c0;”><span style=”font-family: Monospace;”><span style=”font-size: small;”><i>Id</i></span></span></span><span style=”color: #000000;”><span style=”font-family: Monospace;”><span style=”font-size: small;”>=1;</span></span></span></p>
     

    #9837

    Hola Fran, edítalo y vuelve a subirlo para poder visualizarlo mejor. O copia directamente el texto plano

    #9882

    Fran
    Participante

    Hola, Juan Manuel,

    muchas gracias por contestar. No sé qué pasó pero ha aparecido el código en formato HTML. A ver si se ve bien ahora.

    Por otra parte, ¿cómo debe hacerse para que se visualice mejor? En Eclipse la lectura resulta mucho más cómoda al resaltar variables, campos, clases, etc. en diversos colores.

    Tampoco sé bien dónde subir los ejercicios resueltos. Acabo de resolver el del vídeo 55, el de las contraseñas y a priori funciona bien. Sin embargo, el código es bastante diferente a la solución que propone Juan y no estaría de más echarle un vistazo, a ver qué es mejorable.

    Saludos,

    Fran

     

    package ejercicioColegios;

    public class UsoColegio {

    public static void main(String[] args) {
    // TODO Auto-generated method stub

    Colegio AusiasMarch=new Colegio (“Ausiàs March”, 100);

    Colegio CintoVerdaguer=new Colegio(“Mossèn Cinto Verdaguer”, 180);

    AusiasMarch.setNuevoAlumno(“Pepe”, 6.1);;

    AusiasMarch.setNuevoAlumno(“Ana”, 8.2);

    AusiasMarch.setNuevoAlumno(“Vero”, 5.1);

    CintoVerdaguer.setNuevoAlumno(“Xavi”, 6.2);

    CintoVerdaguer.setNuevoAlumno(“Iu”, 8.6);

    AusiasMarch.setNuevoAlumno(“Erika”, 9.0);

    CintoVerdaguer.setNuevoAlumno(“Roberto”, 4.7);

    CintoVerdaguer.setNuevoAlumno(“Nerea”, 6.5);

    CintoVerdaguer.expulsaAlumno(“Iu”);

    AusiasMarch.getTodosAlumnos();

    CintoVerdaguer.getTodosAlumnos();

    CintoVerdaguer.setNotaMedia(“Roberto”, 7);

    CintoVerdaguer.getDatosAlumno(“Roberto”);

    AusiasMarch.expulsaAlumno(“Vero”);

    AusiasMarch.getTodosAlumnos();

    }

    }

    package ejercicioColegios;

    public class Colegio {

    public Colegio (String nombreColegio, int capacidad) {

    this.nombreColegio=nombreColegio;

    MatrizAlumnos=new Alumno[capacidad];

    }

    public String getNombreColegio() {

    return nombreColegio;
    }

    public void setNuevoAlumno(String nombreAlumno, double notaMedia) {//almacena alumnos en la matriz

    Alumno nuevoAlumno=new Alumno(nombreAlumno, this, notaMedia);

    MatrizAlumnos[contador]=nuevoAlumno;

    contador++;
    }

    public void getTodosAlumnos() {

    for (int i=0; i<contador; i++) {

    System.out.println(MatrizAlumnos[i].getImprimeDatosAlumno());
    }

    System.out.println(“—————“);

    }

    public void getDatosAlumno(String nombreAlumno) {

    for (int i=0; i<contador; i++) {

    if (MatrizAlumnos[i].getNombreAlumno().equalsIgnoreCase(nombreAlumno)) {

    System.out.println(“+++++++++++++”);
    System.out.println(MatrizAlumnos[i].getImprimeDatosAlumno());
    System.out.println(“+++++++++++++”);
    }
    }
    }

    public void setNotaMedia(String nombreAlumno, double notaMedia) {

    for (int i=0; i<contador; i++) {

    if (MatrizAlumnos[i].getNombreAlumno().equalsIgnoreCase(nombreAlumno)) {

    Alumno cambioNota=new Alumno(nombreAlumno, this, notaMedia);

    MatrizAlumnos[i]=cambioNota;

    }
    }
    }

    public void expulsaAlumno(String nombreAlumno) {

    for (int i=0; i<contador; i++) {

    if (MatrizAlumnos[i].getNombreAlumno().equalsIgnoreCase(nombreAlumno)) {

    for (int j=i; j<contador; j++) {

    MatrizAlumnos[j]=MatrizAlumnos[j+1];
    }
    contador-=1;
    }
    }
    }

    public final String nombreColegio;

    private Alumno MatrizAlumnos[];

    private int contador;

    }

    package ejercicioColegios;

    public class Alumno {

    public Alumno(String nombreAlumno, Colegio nombreColegio, double notaMedia) {

    this.nombreAlumno=nombreAlumno;

    this.nombreColegio=nombreColegio;

    this.notaMedia=notaMedia;

    Identificacion=Id;

    Id++;

    }

    public String getNombreAlumno() {

    return nombreAlumno;
    }

    public double getNotaMedia () {

    return this.notaMedia;
    }

    public String getColegioAlumno() {

    return this.nombreColegio.getNombreColegio();

    }

    public String getImprimeDatosAlumno() {

    System.out.println();

    return “Nombre alumno: ” + nombreAlumno + “\nColegio: ” + this.getColegioAlumno()
    + “\nNº alumno: ” + Identificacion + “\nNota media: ” + notaMedia;
    }

    private final String nombreAlumno;

    private Colegio nombreColegio;

    private double notaMedia;

    private int Identificacion;

    private static int Id=1;

    }

Viendo 3 publicaciones - del 1 al 3 (de un total de 3)

Debes estar registrado para responder a este debate.

Píldoras Informáticas

Comencé esta aventura para dar soporte a mis alumnos presenciales. Con el apoyo de todos los que me seguís mi canal de YouTube y esta web han crecido mucho más de lo que yo esperaba. Gracias a todos por estar ahí.

Quién está aquí ahora

Foto del perfil de Vladimir
Foto del perfil de Gustavo
Foto del perfil de Tavín
Foto del perfil de Zaid
Foto del perfil de Fernando Casado Aller