Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void procesar()
- {
- Alumno a=new Alumno("Juan",13,15);
- listado(a);
- a.setNota1(19);
- a.setNota2(18);
- listado(a);
- void listado(alumno x)
- {
- imprimir("Nombre: "+x.getNombre());
- imprimir("Nota 1: "+x.getNota1());
- imprimir("Nota 2: "+x.getNota2());
- imprimir("Promedio: "+x.promedio());
- }
- nombre : Juan
- nota 1: 13
- nota 2: 15
- promedio : 14.0
- nombre : Juan
- nota 1: 19
- nota 2: 18
- promedio : 18.5
- public int getNota1()
- {
- return nota1;
- }
- public int getNota2()
- {
- return nota2;
- }
- //Metodos de acceso: set
- public void setNombre(String nom)
- {
- nombre=nom;
- }
- public void setNota1(int n)
- {
- nota1=n;
- }
- public void setNota2(int n)
- {
- nota2=n;
- }
- //Operaciones
- public double promedio()
- {
- return (nota1+nota2)/2.0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement