Documente Academic
Documente Profesional
Documente Cultură
{
private String nombre;
private String direccion;
private String carrera;
private boolean sexo;
private int asigSuper;
private int asigRepro;
private double promedio;
//constructor
public Alumno()
{ this.nombre="NN";
this.direccion="indefinida";
this.carrera="X";
this.sexo=true;
this.asigSuper=0;
this.asigRepro=0;
promedio=0.0;
}
public Alumno(String n, String d, String c)
{ this.nombre=n;
this.direccion=d;
this.carrera=c;
this.sexo=true;
this.asigSuper=0;
this.asigRepro=0;
promedio=0.0;
}
public Alumno(String n, String d, String c,boolean sex,int as, int ar, double
pro)
{ this.nombre=n;
this.direccion=d;
this.carrera=c;
this.sexo=sex;
this.asigSuper=as;
this.asigRepro=ar;
promedio=pro;
}
//accesadores
public String getNombre()
{return nombre;}
public boolean getSexo()
{return sexo;}
public double getPromedio()
{return this.promedio;}
//mutadores
public void setNombre(String nombre)
{ this.nombre=nombre;}
//otros m�todos
public boolean puedeBeca()
{ if(this.promedio>=5.0 && this.asigRepro<2)
return true;
else
return false;
}
////////////////////////////////////////////////////////////////////////
import java.io.*;
public class Main
{
public static void main(String [] args) throws IOException
{
BufferedReader lector=new BufferedReader(new InputStreamReader(System.in));
Alumno a1=new Alumno("juanito","La casa de Juanito","ICCI");
String nom;
System.out.println("Ingrese El nombre del alumno..");
nom=lector.readLine();
a1.setNombre(nom); //cambiamos el nombre de nuestro a1
// otro Alumno
String car,dir;
int as,ar,se;
double pro;
boolean sex;
System.out.println("Ingrese nombre...");
nom=lector.readLine();
System.out.println("Ingrese Direcci�n...");
dir=lector.readLine();
System.out.println("Ingrese Carrera...");
car=lector.readLine();
System.out.println("Ingrese N� asignaturas superadas...");
as=Integer.parseInt(lector.readLine());
System.out.println("Ingrese N� asignaturas reprobadas...");
ar=Integer.parseInt(lector.readLine());
System.out.println("Ingrese promedio...");
pro=Double.parseDouble(lector.readLine());
System.out.println("Ingrese Sexo [1] MASC [2] FEM");
se=Integer.parseInt(lector.readLine());
if(se==1)
sex=true;
else
sex=false;