********sumA, resta , multiplicación y División******

  1. Implementar un programa que me permita ingresar 2 números Los sume, resta , multiplique y Divide

Clase Operar:
 


package Packoper;


public class Operar {
   private int n1;
   private int n2;

    public Operar(int n1, int n2) {
        this.n1 = n1;
        this.n2 = n2;
    }
 
   public int Suma(){
   int s;
   s=this.n1+this.n2;
   return s;
         }
      public int Resta(){
   int s;
   s=this.n1-this.n2;
   return s;
         }
     public int Division(){
   int s;
   s=this.n1/this.n2;
   return s;
         }
      public int Multi(){
   int s=0;
   for (int i=0;i<THIS.N2;I++){< p=""></THIS.N2;I++){<>
 
   s+=this.n1;
 
   }
         return s;
         }
}
Clase Principal: 
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Packoper;

import java.io.*;
public class Principal {
 public static InputStreamReader Leer = new InputStreamReader(System.in);
 public static BufferedReader Teclado = new BufferedReader(Leer);
    
    public static void main(String[] args) throws IOException
    {   int a, b;
    
        System.out.println("Ingrese n1");
        a=Integer.parseInt(Teclado.readLine());
            System.out.println("Ingrese n2");
            b=Integer.parseInt(Teclado.readLine());
    
   
    int d;
            Operar ope= new Operar(a,b);
            d=ope.Suma();
           System.out.println("suma"+d);
           
            d=ope.Resta();
           System.out.println("Resta"+d);
           
            d=ope.Division();
           System.out.println("Division"+d);
            d=ope.Multi();
           System.out.println("Multi"+d);
    
        // TODO code application logic here
    }
}






**********Exponente de un Numero Mediante Sumas********

////////Programa  que me permita elevar un numero a cualquier exponente mediante sumas//////////////////

CLASE PRINCIPAL

package newpackagexponente;
    import java.io.*;

public class principal {
    public static InputStreamReader  leer = new InputStreamReader(System.in);
    public static BufferedReader teclado = new BufferedReader(leer);
   
    public static void main(String[] args)throws IOException
    {
        System.out.println("ingrese la base del numero:");
        int valor1=Integer.parseInt(teclado.readLine());
        System.out.println("ingrese el exponente del numero:");
        int valor2=Integer.parseInt(teclado.readLine());
        exponente Obj1 = new exponente(valor1, valor2);
        Obj1.ExpsumaS();  
    }
}


CLASE  EXPONENTE 


package newpackagexponente;
public class exponente
{
    private int base;
    private int exp;
    public exponente(int base, int exp)
    {
        this.base=base;
        this.exp=exp;
    }
    public exponente()
    {
        this.base=0;
        this.exp=0;
    }
    public void ExpsumaS()
    {
        int res = 1;
        int num = 1;
        for(int con = 0; con<this.exp; con++)
        {
            int acum = 1;
            while(acum<this.base)
            {
                acum++;
                res = num+res;
            }
            num = res;

        }
        System.out.println("resultado es:"+res);

    }
}


******************************************************************************

PROGRAMA DE DIVISION MEDIANTE RESTAS 
CLASE PRINCIPAL

package newpackagedivide;

import java.io.*;

public class principal {
     public static InputStreamReader  leer = new InputStreamReader(System.in);
    public static BufferedReader teclado = new BufferedReader(leer);


    public static void main(String[] args)throws IOException {
        System.out.println("ingrese el numero que se va a dividir:");
        int valor1=Integer.parseInt(teclado.readLine());
        System.out.println("ingrese el numero por el que se va a dividirse:");
        int valor2=Integer.parseInt(teclado.readLine());
        divide Obj1 = new divide(valor1, valor2);
        Obj1.division();
    }  }

CLASE  DIVIDE 

package newpackagedivide;

public class divide {
    private int d;
    private int dv;
    public divide(int d, int dv)
    {
        this.d=d;
        this.dv=dv;
    }
    public divide()
    {
        this.d=0;
        this.dv=0;
    }
    public void division()
    {
        int cont=0,coc=0;
       do{
           coc=this.d-this.dv;
           cont++;
           d=+coc;
          } 
        while(coc >=this.dv);
        System.out.println("resultado:"+cont);
       
    } }




*******Numeros aleatorios*******

Clase Principal


package packaleatorios;
import java.util.Random;


public class principal {


    
    public static void main(String[] args) {
        Random rnd= new Random();
        aleatorios viernes=new aleatorios();
        for(int i=1;i<=10;i++)
        {
            int num= rnd.nextInt(30);
            viernes.setvalor(num);
            if(viernes.VerificarSiNoPrimo())


                System.out.println("Es numero primo : "+num);
            else
                System.out.println("No es un numero primo :"+ num);
            }
        }


}


Clase Aleatorios



package packaleatorios;
public class aleatorios {
private int valor;
public aleatorios()
{
    this.valor=0;
}
public void setvalor(int valor)
{
    this.valor=valor;


}
public boolean VerificarSiNoPrimo()
{
    int cont=0;
    for(int p=1;p<=this.valor;p++)
    {


if(this.valor % p== 0)
    cont++;
}
if(cont<=2)
    return true;
else
    return false;
}




***** Cuenta Bancaria*******

*******Programa de Cuenta Bancaria ***********

CLASE PRINCIPAL

package newpackagecuent_ahorr;
import java.io.*;
public class principal
{
    public static InputStreamReader  leer = new InputStreamReader(System.in);
    public static BufferedReader teclado = new BufferedReader(leer);
  
    public static void main(String[] args)throws IOException
    {
        System.out.println("ingrese nombre");
        String nombre=teclado.readLine();

        System.out.println("ingrese N_cedula");
        int N_cedula=Integer.parseInt(teclado.readLine());
        cuent_ahorr Obj1= new cuent_ahorr();

        System.out.println("ingrese deposito");
        int de=Integer.parseInt(teclado.readLine());

        System.out.println("ingrese retiro");
        int re=Integer.parseInt(teclado.readLine());          
        
        Obj1.deposito(de+100);
        //Obj1.ver_saldo();

        Obj1.retiro(re);
        //Obj1.ver_saldo();

    }
}


*******programas con herencia***********

                                 ***Determinar un programa con Herencia ****





Public class Principal {   
    public static void main(String[] args)
    {
        System.out.println("Creando Objeto Empleado....!");
        //String Cargo, String Departamento,long Cedula, String Nombres, int Edad
        Empleado Juan = new Empleado("Director", "Sistemas","12034576891","Mariuxi Lopez",35);
        Juan.DatosInformativos();
        System.out.println(Juan.CalcularSueldo(60,18));       
        System.out.println("Creando Objeto Estudiante....!");
        //String Colegio, String Semestre, String Cedula, StriSng Nombres, int Edad
        Estudiante Pedro = new Estudiante("Monterrey","Octavo","1207895431","Carlos Torres", 15);
        Pedro.setEspecialidad("Telecomunicacion");
        Pedro.DatosInformativos();
    }
}

CLASE EMPLEADO
public class Empleado extends Persona
{
   private String Cargo;
   private String Departamento;
   public Empleado(String Cargo, String Departamento,String Cedula, String Nombres, int Edad) {
    super(Cedula, Nombres, Edad);
        this.Cargo = Cargo;
        this.Departamento = Departamento;
    }
    @Override
    public void DatosInformativos() {
        super.DatosInformativos();
        System.out.println("Cargo: " + this.Cargo);
        System.out.println("Departamento: " + this.Departamento);
    }  
    public String CalcularSueldo(int numHoras, double valorHora)
    {
      double sueldo = numHoras * valorHora;
      String cadSueldo = " Sueldo: " + String.valueOf(sueldo);
      return cadSueldo;
    }
}


CLASE HIJA  ESTUDIANTE
public class Estudiante extends Persona
{
    private String Colegio;
    private String Semestre;
    private String Especialidad;

    public void setEspecialidad(String Especialidad) {
        this.Especialidad = Especialidad;
    }

    public Estudiante(String Colegio, String Semestre, String Cedula, String Nombres, int Edad) {
        super(Cedula, Nombres, Edad);
        this.Colegio = Colegio;
        this.Semestre = Semestre;
    }

    @Override
    public void DatosInformativos() {
        super.DatosInformativos();
        System.out.println("Colegio: " + this.Colegio);
        System.out.println("Semestre: " + this.Semestre);
        System.out.println("Especialidad: " + this.Especialidad);
    }
   
   
}
CLASE  Persona
public class Persona
{
    private String Cedula;
    private String Nombres;
    private int Edad;

    public Persona(String Cedula, String Nombres, int Edad) {
        this.Cedula = Cedula;
        this.Nombres = Nombres;
        this.Edad = Edad;
    }   
    public void DatosInformativos()
    {
      System.out.println("Cedula Identidad: " + this.Cedula);
      System.out.println("Nombres: " + this.Nombres);
      System.out.println("Edad: " + this.Edad);
    }
   
}


                                                 PANTALLAS DE EJECUCIÓN 











































♫♫♫♫ PROYECTO Nº 2♫♫♫ Con HERENCIA



1.- DESARROLLAR UN PROGRAMA JAVA PARA UNA AGENCIA DE ALQUILER DE CAMIONES PARA TURISMO

Principal
import java.io.*;
public class Principal {
public static InputStreamReader L=new InputStreamReader(System.in);
public static BufferedReader T=new BufferedReader(L);
    public static void main(String[] args) throws IOException{
    cami t=new cami("Tucson","jj-28",false,0,false);
cami t1=new cami("Mazda","nn-99",false,0,false);
 tur tu=new tur("Vitara","gf-234",false,0,false);
 tur tu1=new tur("Chevrolet luv","ss-465",false,0,false);
   boolean jj=false;
   boolean jj1=false;
   boolean tur=false;
   boolean tur1=false;
 int op;
              do{
         System.out.println("ªªªªSe alquila camiones para turismoªªªª");
         System.out.println("ªªªª1.ALQUILAR UN CAMIONªªªªªªªªªªªªªªªª");
         System.out.println("ªªªª2.ALQUILAR BUS DE TURISMOªªªªªªªªªªª");
         System.out.println("ªªªª3.ENTREGA DEL CAMIONªªªªªªªªªªªªªªªª");
         System.out.println("ªªªª4.ENTREGA BUS DE TURISMOªªªªªªªªªªªª");
         System.out.println("ªªªª5.IMFORMATIONªªªªªªªªªªªªªªªªªªªªªªª");
         System.out.println("ªªªª6.EXITªªªªªªªªªªªªªªªªªªªªªªªªªªªªªª");
          op=Integer.parseInt(T.readLine());
                     switch(op){
         case 1:
             t.DatosInformativos();
             t1.DatosInformativos();
                System.out.println("Cual desea 1/2");
 int a=Integer.parseInt(T.readLine());
  if(a==1){
      jj=true;
   System.out.println("Con cuantos dias sale el camion");
  int sa=Integer.parseInt(T.readLine());
   t.definir(sa);
  }
          if(a==2){
      jj1=true;
   System.out.println("Con cuantos dias sale el camion");
  int ssa=Integer.parseInt(T.readLine());
 t1.definir(ssa);
  }
break;
         case 2:
 tu.DatosInformativos();
             tu1.DatosInformativos();
                System.out.println("Cual desea 1/2");
 int as=Integer.parseInt(T.readLine());
  if(as==1){tur=true;
   System.out.println("Con cuantos dias sale el camion");
  int sa=Integer.parseInt(T.readLine());
   tu.definir(sa);
  }
        if(as==2){tur1=true;
   System.out.println("Con cuantos dias sale el camion");
  int ssa=Integer.parseInt(T.readLine());
   tu1.definir(ssa);
  }
break;
               case 3:
              if(jj==true)
                 t.DatosInformativos();
             if(jj1==true)
                 t1.DatosInformativos();
              System.out.println("INGRESE 1 PARA COMENZAR LA ENTREGA");
        int de=Integer.parseInt(T.readLine());
            if ((de==1)&&(jj==true)){
                jj=false;
              System.out.println("DESEA ENTREGAR EL VEHICULO PRESS 1/0");
        int e=Integer.parseInt(T.readLine());
        if(e==1){
            System.out.println("Con cuantos dias es entregado el camion");
        int ee=Integer.parseInt(T.readLine());
                t.de(ee);
             }}
                         if (jj1==true){jj1=false;
             t1.DatosInformativos();
              System.out.println("DESEA ENTREGAR EL VEHICULO PRESS 2/0");
        int e=Integer.parseInt(T.readLine());
        if(e==2){
            System.out.println("CON CUANTOS DIAS ES ENTREGADO");
        int ee=Integer.parseInt(T.readLine());
        t1.de(ee);
             }}
             break;
         case 4:
             if(tur==true)
                 tu.DatosInformativos();
             if(tur1==true)
                 tu1.DatosInformativos();
             System.out.println("INGRESE 1 PARA COMENZAR A ENTREGAR LOS DOS CAMIONES");
        int de5=Integer.parseInt(T.readLine());
             if((de5==1)&& (tur==true)){tur=false;
              System.out.println("DESEA ENTREGAR EL VEHICULO PRESS 1");
        int e=Integer.parseInt(T.readLine());
        if(e==1){
            System.out.println("CON CUANTOS DIAS ES ENTREGADO");
        int ee=Integer.parseInt(T.readLine());
                tu.de(ee);
             }}                     
             if( tur1==true){tur1=false;
              tu1.DatosInformativos();
                    System.out.println("DESEA ENTREGAR EL VEHICULO PRESS 2");
        int e=Integer.parseInt(T.readLine());
        if(e==2){
            System.out.println("CON CUANTOS DIAS ES ENTREGADO");
        int ee=Integer.parseInt(T.readLine());
        tu1.de(ee);
             }}                   
             break;
         case 5:
             System.out.println("/////////INFORMATION DE BUSES DE TURISMO/////////");
            tu.DatosInformativos();
            tu1.DatosInformativos();
                        System.out.println("/////////INFORMATION DE CAMIONES/////////////////");
            t.DatosInformativos();
            t1.DatosInformativos();
             break;
                                   }
        }while(op!=6);
    }
}
Cami
public class cami extends camiones
{
          private boolean alquilar;             
        private int numeroskm;
    private boolean devolver;
    public cami(String marca, String matricula, boolean alquilar, int numeroskm, boolean devolver) {
        super(marca, matricula);
        this.alquilar = alquilar;
        this.numeroskm = numeroskm;
        this.devolver = devolver;
    }
    public void definir( int f){
      if(this.alquilar==false){
        System.out.println("listo para Alquilar");
            System.out.println("A Escogido un Camion");
      this.alquilar=true;
  this.numeroskm=f;
  this.DatosInformativos();
    }else  System.out.println("No se encuentra disponibles ningun camion");
   
public void de(int d){
 int cant=0;
               this.alquilar=false;
          System.out.println("Entregando el camion");
      cant=(d-this.numeroskm)*20;
    System.out.println("El total a pagar es:..."+cant+"$");
       }
    @Override
    public void DatosInformativos() {
        super.DatosInformativos();
         if(this.alquilar){
        System.out.println(" Camion ya escogido");
            System.out.println("arranco con  "+this.numeroskm+"  dias");
    }
   else System.out.println("Si hay camiones para alquilar");
    }
      }
Camiones

public class camiones
{
private String marca; 
     private String matricula;
       public camiones(String marca, String matricula) {
        this.marca = marca;
        this.matricula = matricula;
            }   
   public void DatosInformativos()
    {
     System.out.println("");
      System.out.println("Tipo: " + this.marca);
           System.out.println("Numero de matricula: " + this.matricula);
              }
    }
Tur
public class tur extends camiones
{
  private boolean alquilar;             
        private int numeroskm;
    private boolean entregar;
    public tur(String marca, String matricula,  boolean alquilar, int numeroskm, boolean devolver)
 {
        super(marca, matricula);
        this.alquilar = alquilar;
        this.numeroskm = numeroskm;
        this.entregar = entregar;
    }
    public void definir( int f){
      if(this.alquilar==false){
        System.out.println(" listo para Alquilar");
            System.out.println("A Escogido un Camion");
      this.alquilar=true;
    this.numeroskm=f;
  this.DatosInformativos();
    }else  System.out.println("No se encuentra disponibles ningun camion");
    }       
public void de(int d){
 int cant=0;
            this.alquilar=false;
          System.out.println("Entregando el camion");
      cant=(d-this.numeroskm)*20;
    System.out.println("El total a pagar es:..."+cant+"$");
              }       
    @Override
    public void DatosInformativos() {
        super.DatosInformativos();
        if(this.alquilar==true){
        System.out.println(" Camion ya escogido");
            System.out.println("arranco con  "+this.numeroskm+"  KM");
    }
   else System.out.println("Si hay camiones para alquilar");
          }
}

PANTALLAS DE EJECUCIÓN





















*******************************************************
2.- DESARROLLAR UN PROGRAMA JAVA PARA DE UNA BIBLIOTECA  DONDE ENTRAN Y SALEN LIBROS PRESTADO
Principal


import java.io.*;
public class Principal1 {
public static InputStreamReader L=new InputStreamReader(System.in);
public static BufferedReader T=new BufferedReader(L);
    public static void main(String[] args) throws IOException{      
    int op=0;
          linros dd=new linros("la bella durmiente","edi",5,5,false);
     linros dd1=new linros("oceano","edi2",5,5,false);
         linros dd2=new linros("platero y yo","edi2",5,5,false);
     revista re=new revista("fashion express","desconocido",5,5,false);
     revista re1=new revista("mistica","desconocido",5,5,false);
     revista re2=new revista("nivi","desconocio",5,5,false);
     int veri=0;
    int veri1=0;
     int veri2=0;
    int rev=0;
     int rev1=0;
     int rev2=0;
                 do{
         System.out.println("ªªªªª    BIBLIOTECA  ªªªªªªªªªªªª");
         System.out.println("ªªªªª1.LLEVAR UN BOOKªªªªªªªªªªªª");
         System.out.println("ªªªªª2.LLEVAR UNA REVISTAªªªªªªªª");
         System.out.println("ªªªªª3.ENTREGAR BOOKªªªªªªªªªªªªª");
         System.out.println("ªªªªª4.DEVOLVER REVISTAªªªªªªªªªª");
         System.out.println("ªªªªª5.IMFORMATIONªªªªªªªªªªªªªªª");
         System.out.println("ªªªªª6.EXITªªªªªªªªªªªªªªªªªªªªªª");
          op=Integer.parseInt(T.readLine());
                     switch(op){
         case 1:
                          dd.Datos1();
             dd1.Datos1();
             dd2.Datos1();
             System.out.println("ELIJA EL BOOK QUE PREFIERA");
             System.out.println("INGRESE  1/2/3");
 int a=Integer.parseInt(T.readLine());
 if(a==1){
     veri=1;
 dd.al();
 System.out.println("CUANTAS COPIAS PREFIERE");
 int co=Integer.parseInt(T.readLine());
 dd.definir(co);
 }
  if(a==2){
      veri1=1;
 dd1.al();
 System.out.println("CUANTAS COPIAS PREFIERE");
 int co=Integer.parseInt(T.readLine());
 dd1.definir(co);
 }
  if(a==3){veri2=1;
 dd2.al();
 System.out.println("CUANTAS COPIAS PREFIERE");
 int co=Integer.parseInt(T.readLine());
 dd2.definir(co);
 }
break;
        case 2:
                            re.Datos1();
             re1.Datos1();
             re2.Datos1();
             System.out.println("ELIJA LA REVISTA QUE PREFIERA");
             System.out.println("INGRESE  1/2/3");
 int va=Integer.parseInt(T.readLine());
 if(va==1){rev=1;
 re.al();
 System.out.println("CUANTAS COPIAS PREFIERE");
 int co=Integer.parseInt(T.readLine());
 re.definir(co);
 }
  if(va==2){rev1=1;
 re1.al();
 System.out.println("CUANTAS COPIAS PREFIERE");
 int co=Integer.parseInt(T.readLine());
 re1.definir(co);
 }
  if(va==3){rev2=1;
 re2.al();
 System.out.println("CUANTAS COPIAS PREFIERE");
 int co=Integer.parseInt(T.readLine());
 re2.definir(co);
 }
        break;
               case 3:
   if(veri==1){
   dd.devo();
  veri=2;
   }
   if(veri1==1){
   dd1.devo();
  veri=2; }
   if(veri2==1){
   dd2.devo();
   veri=2; }
   if (veri==2){
      System.out.println("CUANTAS COPIAS VA A ENTREGAR");
 int cop=Integer.parseInt(T.readLine());
   dd.de(cop);}
   if (veri1==2){
      System.out.println("CUANTAS COPIAS VA A ENTREGAR");
 int copy=Integer.parseInt(T.readLine());
   dd1.de(copy);
   }
   if (veri2==2){
      System.out.println("CUANTAS COPIAS VA A ENTREGAR");
 int copi=Integer.parseInt(T.readLine());
   dd2.de(copi);
   }
      break;
  case 4:
             if(rev==1){
   re.devo();
  rev=2;
   }
   if(rev1==1){
   re1.devo();
  rev1=2; }
   if(rev2==1){
   re2.devo();
   rev2=2; }
   if (rev==2){
      System.out.println("CUANTAS COPIAS VA A ENTREGAR");
 int cop=Integer.parseInt(T.readLine());
   re.de(cop);
   }
   if (rev1==2){
      System.out.println("CUANTAS COPIAS VA A ENTREGAR");
 int copy=Integer.parseInt(T.readLine());
   re1.de(copy);
   }
   if (rev2==2){
      System.out.println("CUANTAS COPIAS VA A ENTREGAR");
 int copi=Integer.parseInt(T.readLine());
   re2.de(copi);
   }
                          break;
           case 5:
             System.out.println("/////////INFORMATION DE BOOK/////////");
          dd.Datos1();
          dd1.Datos1();
          dd2.Datos1();
             System.out.println("/////////INFORMATION DE REVISTAS/////////////////");
             re.Datos1();
             re1.Datos1();
                         re2.Datos1();
             break;
                        }
        }while(op!=6);
        }}
Linros
import java.io.*;
public class linros extends publi
{
 public static InputStreamReader Leer = new InputStreamReader(System.in);
 public static BufferedReader Teclado = new BufferedReader(Leer);
              private int numcopias;
            private boolean prestar;
    public linros(String nombre, String editorial, int numcopi, int numcopias,  boolean prestar) {
        super(nombre, editorial, numcopi);
        this.numcopias = numcopias;
              this.prestar = prestar;
          }
    public void al()
{   
          if(this.numcopias>1){
        System.out.println("SI SE PUEDE LEER EN CASA ");
               }else  System.out.println("NO SE PUEDE LEER EN CASA ");
             }
   public void definir( int f){
       if(f<=this.numcopias){
     System.out.println("A ESCOJIDO EL BOOK ");
  this.numcopias-=f;
         this.prestar=true;
  this.Datos1(); 
         }else System.out.println("no hay bastantes copias ");
     }
        public void devo(){
                  if(this.prestar==true){
     this.Datos1(); 
  }  }
          public void de(int d){          
              this.prestar=false;  
      this.numcopias+=d;
       System.out.println("BOOK ENTREGADO A BIBLIOTECA ");
            }
          @Override
    public void Datos1() {
        super.Datos1();
        System.out.println("QUEDAN "+this.numcopias+"BOOK ");
         if(this.numcopias>1)
          System.out.println("BOOK PRESTABLE ");
        else System.out.println("BOOK NO DISPONIBLE ");
           } }
Public
public class publi
{       
    private String nombre;
    private String editorial;
  private int numcopi;

    public publi(String nombre, String editorial, int numcopi) {
        this.nombre = nombre;
        this.editorial = editorial;
        this.numcopi = numcopi;
    }      
   public void Datos1()
    {
     System.out.println("");
      System.out.println("NOMBRE :   " + this.nombre);
           System.out.println("NAME DE LA EDITORIAL: " + this.editorial);
        System.out.println("NUMBER DE PUBLICACIONES:   "+this.numcopi);
              }
   }                                                                                  




3.-
Revista
import java.io.*;
public class revista extends publi
{
    public static InputStreamReader Leer = new InputStreamReader(System.in);
 public static BufferedReader Teclado = new BufferedReader(Leer);
     private int numcopias;
          private boolean prestar;
    public revista(String nombre, String editorial, int numcopi, int numcopias, boolean prestar) {
        super(nombre, editorial, numcopi);
        this.numcopias = numcopias;
        this.prestar = prestar;
    }
        public void al(){    
          if(this.numcopias>1){
        System.out.printn("SI SE PUEDE LEER EN CASA ");
               }else  System.out.println("NO SE PUEDE LEER EN CASA");
              }
   public void definir( int f){
       if(f<=this.numcopias){
     System.out.println("A LLEVADO UN BOOK ");
  this.numcopias-=f;
         this.prestar=true;
  this.Datos1();
        }else System.out.println("No hay bastantes copias ");
     }
        public void devo(){      
         if(this.prestar==true){
     this.Datos1();
   }
    } 
          public void de(int d){
                System.out.println("INGRESE 1 PARA ENTGREGAR ESTE BOOK ");
              this.prestar=false;  
      this.numcopias+=d;
       System.out.println("BOOK ENTREGADO A BIBLIOTECA ");   
      }
     
    @Override
    public void Datos1() {
        super.Datos1();
         System.out.println("QUEDAN "+this.numcopias+"BOOK ");
        if(this.numcopias>1)
          System.out.println("BOOK PRESTABLE ");
        else System.out.println("BOOK DISPONIBLE ");
    }
}
PANTALLAS EN EJECUCION






3.-DESARROLLAR UN PROGRAMA JAVA PARA CONSTRUIR UN ROBOT

PANEL

package robot;
import java.awt.Graphics;
public class Panel extends javax.swing.JPanel {
    private int X=60;
private int Y=68;
private int S=3;
private int H=3;
    public Panel() {
        initComponents();
    }

    @SuppressWarnings("unchecked")



@Override
    public void paint(Graphics g) {
        super.paint(g);
g.drawLine(0, 0, 125, 0);
g.drawLine(0, 25, 125, 25);
g.drawLine(0, 50, 125, 50);
g.drawLine(0, 75, 125, 75);
g.drawLine(0, 100, 125, 100);
g.drawLine(0, 125, 125, 125);

g.drawLine(0, 0, 0, 125);
g.drawLine(25, 0, 25, 125);
g.drawLine(50, 0, 50, 125);
g.drawLine(75, 0, 75, 125);
g.drawLine(100, 0, 100, 125);
g.drawLine(125, 0, 125, 125);
String r="ª";
g.drawString(r, X, Y);
}
public void Izquierda(){
if (this.S>1){
this.S--;
    this.X-=23;
repaint();
}}
public void derecha(){
if (this.S<5){
this.S++;
    this.X+=23;
repaint();
}}
public void arriba(){
if (this.H<5){
this.H++;
    this.Y-=23;
repaint();
}}
public void abajo(){
if (this.H>1){
this.H--;
    this.Y+=23;
repaint();
}}}
package robot;
public class robotpri1 extends javax.swing.JFrame {
         public robotpri1() {
        initComponents();
    } 
    @SuppressWarnings("unchecked")



    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
p1.Izquierda();   
                    }                                        
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
p1.derecha();
        // TODO add your handling code here:
    }                                       
    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                        
p1.arriba();
        // TODO add your handling code here:
    }                                    
    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {                                        
p1.abajo();
        // TODO add your handling code here:
    }                                       
    private void texActionPerformed(java.awt.event.ActionEvent evt) {                                    
String a=this.tex.getText();
    }                                  
    private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
    }                                       
        public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new robotpri1().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify                    
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private robot.Panel p1;
    private java.awt.TextField tex;
    // End of variables declaration                  
}

PANTALLAS EN EJECUCIÓN