sábado, 6 de julio de 2013

CLASE

EJERCICIO "24"

CIUDADANO

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ciudadano;

/**
 *
 * @author GATO
 */
class Humano {

    /**
     * @param args the command line arguments
     */
    String Nombre, Apellido;
        int Edad;
        public Humano (String nombre, String apellido, int edad)
        {
            this.Nombre  = nombre;
            this.Apellido = apellido;
            this.Edad= edad;
           
        }
        public void MuestraNombre(){
            System.out.println(Nombre);
            System.out.println(Apellido);
            System.out.println(Edad);
        }
}

public class Ciudadano extends Humano{
   
    String Cedula;
    public Ciudadano(String nombre, String apellido, int edad, String cedula){
    super( nombre,apellido, edad);
    this.Cedula=cedula;
    }
   public void  Muestracedula (){
       System.out.println(Cedula);
}
           
           
    public static void main(String[] args) {

       Ciudadano a1=new Ciudadano("DIEGUITO", "DURAN", 21, "1600731671");
       a1.MuestraNombre();
       a1.Muestracedula();
     
       
    }
}



CLASE

EJERCICIO "23"

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package choche2;
import java.util.Scanner;

/**
 *
 * @author GATO
 */
public class CHOCHE2 {

    /**
     * @param args the command line arguments
     */
    String COOPERATIVA, MARCA, RUTA1, RUTA2, RUTA3;
      int ACIENTOS;
   
    public CHOCHE2()
            {
              Scanner teclado = new Scanner(System.in);
              System.out.println("      TRASPORTE  PROVINCIAL ");
              System.out.println(" ");
              System.out.println("COOPERATIVA:");
              this.COOPERATIVA  = teclado.nextLine();
              System.out.println(" ");
              System.out.println("MARCA DEL VEHICULO: ");
              this.MARCA  = teclado.nextLine();
              System.out.println(" ");
              System.out.println(" INGRESE TRES RUTAS DE RECORRIDO:  ");
              System.out.println(" ");
              System.out.println("RUTA 1: ");
              this.RUTA1  = teclado.nextLine();
              System.out.println(" ");
              System.out.println("RUTA 2: ");
              this.RUTA2  = teclado.nextLine();
              System.out.print(" ");
              System.out.println("RUTA 3: ");
              this.RUTA3  = teclado.nextLine();
              System.out.print(" ");
              System.out.println("NUMERO DE ACIENTOS DEL VEHICULO: ");
              this.ACIENTOS  = teclado.nextInt();
             
           
            }
    public void MuestraCAR (){
        System.out.println(COOPERATIVA);
       
        System.out.println(MARCA);
       
        System.out.println(RUTA1);
       
        System.out.println(RUTA2);
       
        System.out.println(RUTA3);
       
        System.out.println(ACIENTOS);
    }
    public static void main(String[] args) {
        // TODO code application logic here
        CHOCHE2 hl=new CHOCHE2();
        hl.MuestraCAR();
    }
}



CLASE

EJERCICIO "22"

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package carga;


/**
 *
 * @author GATO
 */
public class Carga {

    /**
     * @param args the command line arguments
     */
    //Ejemplo de clase con dos constructores y un método
public class Persona {
    private String carro;
    private int kilometrage;
    private int Yantas;

    public Persona (String nombrecarro) {  
       carro = nombrecarro;
       kilometrage = 0;    
       Yantas=0; }
    public Persona () {  
       carro = "";
       kilometrage = 0;
       Yantas=0; }

    public String getNombre () { return carro; }
 
}
    public static void main(String[] args) {
        // TODO code application logic here
       
    }
}

EREDACION

EJERCICIO  "21"
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package caballo;

class Animal {
    public void comer () {
        System.out.println("Animal comiendo.....");
    }
    }

public class Caballo  extends Animal {
    public void comer(){
        System.out.println("Caballo comiendo.....");
    }
   

   
    public static void main(String[] args) {
        // TODO code application logic here
        Animal a = new Animal();
        Caballo c = new Caballo();
        a.comer();
        c.comer();
       
    }
}



CLASE

EJERCICIO

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aves;

/**
 *
 * @author mini
 */
public class Aves {

    /**
     * @param args the command line arguments
     */
    String Clase, Sexo;
    public Aves(String clase, String sexo)
    {
        this.Clase=clase;
        this.Sexo=sexo;
    }
    public void muestraAves()
    {
        System.out.println(Clase);
        System.out.println(Sexo);
    }
}


EREDACION

EJERCICIO "19"

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rapiña;

/**
 *
 * @author mini
 */
class Aves {

    /**
     * @param args the command line arguments
     */
    String Clase, Sexo;
    public Aves(String clase, String sexo)
    {
        this.Clase=clase;
        this.Sexo=sexo;
    }
    public void muestraAves()
    {
        System.out.println(Clase);
        System.out.println(Sexo);
    }
}
public class Rapiña extends Aves {

    /**
     * @param args the command line arguments
     */
    String Color, Nombre;
    double Peso;
    public Rapiña(String clase, String sexo, String color, String nombre, double peso)
    {
        super(clase, sexo);
        this.Color=color;
        this.Peso=peso;
        this.Nombre=nombre;
    }
    public void muestraRapiña()
    {
        System.out.println(Color);
        System.out.println(Peso);
        System.out.println(Nombre);
    }
    public static void main(String[] args) {
        // TODO code application logic here
        Rapiña r1 = new Rapiña ("Rapiña", "hembra", "negro", "aguila", 3.4);
        r1.muestraAves();
        r1.muestraRapiña();
    }
}



CLASE

EJERCICIO  "18"

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package humano;
import java.util.Scanner;


/**
 *
 * @author GATO
 */
public class Humano {

    /**
     * @param args the command line arguments
     */
    String Nombre, Apellido;
        int Edad;
        public Humano ()
        {
             Scanner teclado = new Scanner(System.in);
             System.out.print("Ingrese el nombre: ");
            this.Nombre  = teclado.nextLine();
            System.out.print("Ingrese el apellido: ");
            this.Apellido = teclado.nextLine();
             System.out.print("Ingrese la edad:");
            this.Edad= teclado.nextInt();
            
        }
        public void MuestraNombre(){
            System.out.println(Nombre);
            System.out.println(Apellido);
            System.out.println(Edad);
        }
    public static void main(String[] args) {
        // TODO code application logic here
        Humano hl=new Humano();
        hl.MuestraNombre();
       
        
    }
}