Está en la página 1de 4

Sanchez Badillo Axel Eduardo

Reto#9 secuencia 2NM40


CLASE LIBRE
Diagrama de clases
Persona
private String nombre;
private String cedula;
private char sexo;
private int edad;
public Persona()
public Persona(String nombre, String cedula, char sexo,int
edad )
public void imprimir()

Programa
this.nombre = nombre;
this.cedula = cedula;
this.sexo = sexo;
this.edad = edad;

Tabla de pruebas
Codigo
public class Persona
{
// instance variables - replace the example below with your own
private String nombre;
private String cedula;
private char sexo;
private int edad;

/**
* Constructor for objects of class Persona
*/
public Persona()
{
nombre= "";
cedula = "0000000000";
sexo = 'F';
edad =0;

public Persona(String nombre, String cedula, char sexo,int edad )


{
this.nombre = nombre;
this.cedula = cedula;
this.sexo = sexo;
this.edad = edad;
}
/**
* An example of a method - replace this comment with your own
*
* @param y a sample parameter for a method
* @return the sum of x and y
*/
public void imprimir()
{
System.out.println("Nombre"+ nombre);
System.out.println("Cedula"+ cedula);
System.out.println("Edad"+ edad);
System.out.println("Sexo"+ sexo);
}
}
Prueba unitaria

También podría gustarte