Mostrando entradas con la etiqueta Taller POO 2° Entrega. Mostrar todas las entradas
Mostrando entradas con la etiqueta Taller POO 2° Entrega. Mostrar todas las entradas

martes, 8 de noviembre de 2011

Autogeneracón de Codigo

El codigo que genere, de acuerdo a mi diagrama fue el siguiente:

Clase Administrador

/**
 * Class Administrador
 */
public class Administrador {

  //
  // Fields
  //

  private void Bienvenida;
  
  //
  // Constructors
  //
  public Administrador () { };
  
  //
  // Methods
  //


  //
  // Accessor methods
  //

  /**
   * Set the value of Bienvenida
   * @param newVar the new value of Bienvenida
   */
  private void setBienvenida ( void newVar ) {
    Bienvenida = newVar;
  }

  /**
   * Get the value of Bienvenida
   * @return the value of Bienvenida
   */
  private void getBienvenida ( ) {
    return Bienvenida;
  }

  //
  // Other methods
  //

}

Clase Cliente

/**
 * Class Cliente
 */
public class Cliente {

  //
  // Fields
  //

  private void Nombre;
  private void Apellido_Paterno;
  private void Apellido_Materno;
  private void Direccion;
  private void Telefono;
  
  //
  // Constructors
  //
  public Cliente () { };
  
  //
  // Methods
  //


  //
  // Accessor methods
  //

  /**
   * Set the value of Nombre
   * @param newVar the new value of Nombre
   */
  private void setNombre ( void newVar ) {
    Nombre = newVar;
  }

  /**
   * Get the value of Nombre
   * @return the value of Nombre
   */
  private void getNombre ( ) {
    return Nombre;
  }

  /**
   * Set the value of Apellido_Paterno
   * @param newVar the new value of Apellido_Paterno
   */
  private void setApellido_Paterno ( void newVar ) {
    Apellido_Paterno = newVar;
  }

  /**
   * Get the value of Apellido_Paterno
   * @return the value of Apellido_Paterno
   */
  private void getApellido_Paterno ( ) {
    return Apellido_Paterno;
  }

  /**
   * Set the value of Apellido_Materno
   * @param newVar the new value of Apellido_Materno
   */
  private void setApellido_Materno ( void newVar ) {
    Apellido_Materno = newVar;
  }

  /**
   * Get the value of Apellido_Materno
   * @return the value of Apellido_Materno
   */
  private void getApellido_Materno ( ) {
    return Apellido_Materno;
  }

  /**
   * Set the value of Direccion
   * @param newVar the new value of Direccion
   */
  private void setDireccion ( void newVar ) {
    Direccion = newVar;
  }

  /**
   * Get the value of Direccion
   * @return the value of Direccion
   */
  private void getDireccion ( ) {
    return Direccion;
  }

  /**
   * Set the value of Telefono
   * @param newVar the new value of Telefono
   */
  private void setTelefono ( void newVar ) {
    Telefono = newVar;
  }

  /**
   * Get the value of Telefono
   * @return the value of Telefono
   */
  private void getTelefono ( ) {
    return Telefono;
  }

  //
  // Other methods
  //

  /**
   * @return       char
   */
  public char ingresar_Nombre(  )
  {
  }


  /**
   * @return       char
   */
  public char Ingresar_App(  )
  {
  }


  /**
   * @return       char
   */
  public char Ingresar_Apm(  )
  {
  }


  /**
   * @return       char
   */
  public char Ingresar_Dir(  )
  {
  }


  /**
   * @return       int
   */
  public int Ingresar_tel(  )
  {
  }

}

Clase Mascota

/**
 * Class Mascota
 */
public class Mascota extends Cliente {

  //
  // Fields
  //

  private char NombredeMascota;
  private char Edad_de_Mascota;
  private char SexodeMascota;
  private char Raza;
  
  //
  // Constructors
  //
  public Mascota () { };
  
  //
  // Methods
  //


  //
  // Accessor methods
  //

  /**
   * Set the value of NombredeMascota
   * @param newVar the new value of NombredeMascota
   */
  private void setNombredeMascota ( char newVar ) {
    NombredeMascota = newVar;
  }

  /**
   * Get the value of NombredeMascota
   * @return the value of NombredeMascota
   */
  private char getNombredeMascota ( ) {
    return NombredeMascota;
  }

  /**
   * Set the value of Edad_de_Mascota
   * @param newVar the new value of Edad_de_Mascota
   */
  private void setEdad_de_Mascota ( char newVar ) {
    Edad_de_Mascota = newVar;
  }

  /**
   * Get the value of Edad_de_Mascota
   * @return the value of Edad_de_Mascota
   */
  private char getEdad_de_Mascota ( ) {
    return Edad_de_Mascota;
  }

  /**
   * Set the value of SexodeMascota
   * @param newVar the new value of SexodeMascota
   */
  private void setSexodeMascota ( char newVar ) {
    SexodeMascota = newVar;
  }

  /**
   * Get the value of SexodeMascota
   * @return the value of SexodeMascota
   */
  private char getSexodeMascota ( ) {
    return SexodeMascota;
  }

  /**
   * Set the value of Raza
   * @param newVar the new value of Raza
   */
  private void setRaza ( char newVar ) {
    Raza = newVar;
  }

  /**
   * Get the value of Raza
   * @return the value of Raza
   */
  private char getRaza ( ) {
    return Raza;
  }

  //
  // Other methods
  //

  /**
   * @return       char
   */
  public char IngresarNMas(  )
  {
  }


  /**
   * @return       char
   */
  public char Ingresaredad(  )
  {
  }


  /**
   * @return       char
   */
  public char IngresarSexo(  )
  {
  }


  /**
   * @return       char
   */
  public char IngresarRaza(  )
  {
  }


}

Clase Negocio


/**
 * Class Negocio
 */
public class Negocio {

  //
  // Fields
  //

  private char Productos;
  private int Precio;
  
  //
  // Constructors
  //
  public Negocio () { };
  
  //
  // Methods
  //


  //
  // Accessor methods
  //

  /**
   * Set the value of Productos
   * @param newVar the new value of Productos
   */
  private void setProductos ( char newVar ) {
    Productos = newVar;
  }

  /**
   * Get the value of Productos
   * @return the value of Productos
   */
  private char getProductos ( ) {
    return Productos;
  }

  /**
   * Set the value of Precio
   * @param newVar the new value of Precio
   */
  private void setPrecio ( int newVar ) {
    Precio = newVar;
  }

  /**
   * Get the value of Precio
   * @return the value of Precio
   */
  private int getPrecio ( ) {
    return Precio;
  }

  //
  // Other methods
  //

  /**
   * @return       char
   */
  public char Ingresarprod(  )
  {
  }


  /**
   * @return       char
   */
  public char EliminarProd(  )
  {
  }


  /**
   * @return       int
   */
  public int EditarPrecio(  )
  {
  }

}

Estos codigos autogenerados, no difieren mucho del codigo que yo tenia, solamente en los metodos get y set, que son para obtener y modificar el valor de las variables.

Saludos :)

jueves, 27 de octubre de 2011

Documentación Técnica

Herencia :)

La herencia en mi proyecto aplica en las clases Cliente y Mascota, como ya lo habia mencionado en la entrada de herencia en Programación Orientada a Objetos, Ya que Mascota es un tipo de Cliente.

Este es el codigo de Mascota, tiene algunos Metodos, que pertenecen a esta clase.

public class Mascota extends Cliente{

 //Atributos
 private static String nombre;
 private static String raza;
 private static String nacimiento;
 private static String sexo;
 
// Constructor
public Mascota(){ 
 ingresarnom();
 ingresarra();
 ingresarnac();
 ingresarsex();
}
//Metodos
public String ingresarnom() {
 return nombre;
 
}

public String ingresarra() {
 return raza;
}

public String ingresarnac() {
 return nacimiento;
}

public String ingresarsex() {
 return sexo; 
}


public static void main(String[] args){
 
char opc ;
int opc1 ;
 Mascota altanom, altara, altanac, altasex ;
 altanom = new Mascota();
 altara = new Mascota();
 altanac = new Mascota();
 altasex = new Mascota();
 Scanner leer = new Scanner(System.in);
 Scanner in = new Scanner(System.in);
 
 //nombre
 System.out.println("\nNombre: ");
 opc = leer.next().charAt(0);
 nombre = altanom.ingresarnom();
 
 //Raza
 System.out.println("\nRaza ");
 opc = leer.next().charAt(0);
 raza = altara.ingresarra();
 
 //Sexo
 System.out.println("\nSexo: ");
 opc = leer.next().charAt(0);
 sexo = altasex.ingresarsex();
 
 //fecha de nacimiento
 System.out.println("\nFecha de Nacimiento: ");
 opc = leer.next().charAt(0);
 nacimiento = altanac.ingresarnac();

} 
}

Este Codigo es el de la clase padre, Cliente.

public class Cliente {

 //Atributos
 private static String nombre;
 private static String apellidop;
 private static String apellidom;
 private static String telefonoh;
 private static String telefonoc;
 private static String email;
 private static String domicilio;
 
// Constructor
public Cliente(){ 
 ingresarnom();
 ingresarapp();
 ingresarapm();
 ingresarth();
 ingresartc();
 ingresarem();
 ingresardom(); 
}
public String ingresarnom() {
 return nombre;
 
}

public String ingresarapp() {
 return apellidop;
}

public String ingresarapm() {
 return apellidom;
}

public String ingresarth() {
 return telefonoh; 
}

public String ingresartc() {
 return telefonoc; 
}

public String ingresarem() {
 return email;
}

public String ingresardom() {
 return domicilio;
 
}

public static void main(String[] args){

char opc ;
int opc1 ;
 Cliente altanom, altaapp, altaapm, altath, altatc, altaem, altadom;
 altanom = new Cliente();
 altaapp = new Cliente();
 altaapm = new Cliente();
 altath = new Cliente();
 altatc = new Cliente();
 altaem = new Cliente();
 altadom = new Cliente();
 Scanner leer = new Scanner(System.in);
 
 //nombre
 System.out.println("\nNombre: ");
 opc = leer.next().charAt(0);
 nombre = altanom.ingresarnom();
 
 //apellido Paterno
 System.out.println("\nApellido Paterno: ");
 opc = leer.next().charAt(0);
 apellidop = altaapp.ingresarapp();
 
 //Apellido Materno
 System.out.println("\nApellido Materno: ");
 opc = leer.next().charAt(0);
 apellidom = altaapm.ingresarapm();
 
 //Telefono casa
 System.out.println("\nTelefono fijo: ");
 opc1 = leer.nextInt();
 telefonoh = altath.ingresarth();
 
 //Telefono movil
 System.out.println("\nTelefono movil: ");
 opc = leer.next().charAt(0);
 telefonoc = altatc.ingresartc();
 
 //email
 System.out.println("\ne-mail: ");
 opc = leer.next().charAt(0);
 email = altaem.ingresarem();
 
 //Direccion
 System.out.println("\nDireccion:");
 opc = leer.next().charAt(0);
 domicilio = altadom.ingresardom();
}
}

Aqui los metodos de Cliente tambien se usaran en Mascota, ya que no puede haber ninguna mascota sin Dueño, y este dueño necesita los datos que se ingresan en la clase cliente, Pero tambien puede llegar alguna persona, que solo necesite de algun producto, entonces tambien se necesitan estos datos.

Saludos :)