java netbeans

41
JAVA NETBEANS ALQUILER DE VEICULOS Este programa realiza alquiler de carros de turismo y camiones, funciona mediante herencia que consiste de heredar variables y métodos de una clase padre a una hija para lo cual e usado dos clase padres y dos hijas para diferenciar y que se entienda mejor, a continuasion el código correspondiente: Clase principal modo main: 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{ // public static void main(String[] args) System.out.println("TURISMO....!");

Upload: thedarkknight691

Post on 27-Dec-2015

70 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Java Netbeans

JAVA NETBEANSALQUILER DE VEICULOSEste programa realiza alquiler de carros de turismo y camiones, funciona mediante herencia que consiste de heredar variables y métodos de una clase padre a una hija para lo cual e usado dos clase padres y dos hijas para diferenciar y que se entienda mejor, a continuasion el código correspondiente:

Clase principal modo main:

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{

// public static void main(String[] args)

System.out.println("TURISMO....!");

//String Cargo, String Departamento,long Cedula, String Nombres, int Edad

turismo bus = new turismo("HINO","hj-345", 2,"CHEBROLET","hj-333", 3);

Page 2: Java Netbeans

bus.DatosInformativos();

bus.datos();

System.out.println("CAMIONES....!");

camiones car = new camiones("GMS","df-323",20,"HINO","df-323", 30);

/* car.camion1("df-323", false);

car.camion2("hh-346", false);*/

car.DatosInformativos();

car.datos();

int op;

//tur tu=new tur("MERCEDES","df-323",23,"MAZDA","df-323", 33,false,false,false,false,0);

cami aa=new cami("GMS","df-323",20,"HINO","df-323", 30,false,false,false,false,0);

tur turi=new tur("MERCEDES","df-323",2,"MAZDA","df-323", 3,false,false,false,false,0);

do{

System.out.println("*********ALQUILER DE CAMIONES Y TURISMO*********");

System.out.println("*********   1. ALQUILAR UN CAMION     *********");

System.out.println("+******** 2. ALQUILAR BUS DE TURISMO   *********");

Page 3: Java Netbeans

System.out.println("*********     3.DEBOLVER CAMION       *********");

System.out.println("********* 4.DEBOLVER BUS DE TURISMO    *********");

System.out.println("*********        5.IMFORMACION        *********");

System.out.println("*********           6.SALIR           *********");

op=Integer.parseInt(T.readLine());

switch(op){

case 1:

System.out.println("PRESIONE  1 PARA ALQUILAR CASO CONTRARIO 0");

int a=Integer.parseInt(T.readLine());

aa.al(a);

System.out.println("cual veiculo desea alquilar 1/2");

int aaa=Integer.parseInt(T.readLine());

System.out.println("CON CUANTOS DIAS SALE EL VEICULO");

int aaaa=Integer.parseInt(T.readLine());

aa.definir(aaa,aaaa);

break;

case 2:

Page 4: Java Netbeans

System.out.println("PRESIONE  1 PARA ALQUILAR CASO CONTRARIO 0");

int at=Integer.parseInt(T.readLine());

turi.al(at);

System.out.println("cual veiculo desea alquilar 1/2");

int aaat=Integer.parseInt(T.readLine());

System.out.println("CON CUANTOS QUILOMETROS SALE EL VEICULO");

int aaaat=Integer.parseInt(T.readLine());

turi.definir(aaat, aaaat);

break;

case 3:

System.out.println("DESEA DEVOLVER EL VEICULO 1/0");

int e=Integer.parseInt(T.readLine());

aa.devo(e);

System.out.println("CUAL DESEA DEVOLVER 1/2");

int r=Integer.parseInt(T.readLine());

System.out.println("CON CUANTOS DIAS DEVUELVE EL VEICULO");

int rr=Integer.parseInt(T.readLine());

aa.de(r, rr);

break;

Page 5: Java Netbeans

case 4:

System.out.println("DESEA DEVOLVER EL VEICULO 1/0");

int ee=Integer.parseInt(T.readLine());

turi.devo(ee);

System.out.println("CUAL DESEA DEVOLVER 1/2");

int tr=Integer.parseInt(T.readLine());

System.out.println("CON CUANTOS KM DEVUELVE EL VEICULO");

int rrr=Integer.parseInt(T.readLine());

turi.de(tr, rrr);

break;

case 5:

System.out.println("/////////INFORMACION DE BUSES DE TURISMO/////////");

turi.DatosInformativos();

turi.datos();

System.out.println("/////////INFORMACION DE CAMIONES/////////////////");

aa.DatosInformativos();

aa.datos();

break;

Page 6: Java Netbeans

}

}while(op!=6); }}

Clase padre 1 “camion”

public class camiones

{ private String marca;

private String matricula;

private int valordia;

private String marca1;

private String matricula1;

private int valordia1;

public camiones(String mar,String matricula, int va,String mar1,String matricula1, int alquilado1) {

this.marca=mar;

this.marca1=mar1;

this.matricula = matricula;

this.valordia = va;

this.matricula1 = matricula1;

this.valordia1 = alquilado1;

Page 7: Java Netbeans

}

public void DatosInformativos()

{

System.out.println("camiones");

System.out.println("tipo de bus: " + this.marca);

System.out.println("#1  "+"matricula: " + this.matricula);

System.out.println("valor por dia   $"+this.valordia);

}

public void datos(){

System.out.println("tipo de bus: " + this.marca1);

System.out.println("#2  "+"matricula: " + this.matricula1);

System.out.println("valor por dia"+this.valordia1);

}

}

Clase hija:”cami”

import java.io.*;

public class cami extends camiones

{

public static InputStreamReader Leer = new InputStreamReader(System.in);

public static BufferedReader Teclado = new BufferedReader(Leer);

private boolean alquilar;

Page 8: Java Netbeans

private boolean alquilar1;

private int numeroskm;

private boolean devolver;

private boolean devolver1;

public cami(String mar, String matricula, int va, String mar1, String matricula1, int alquilado1, boolean alquilar, boolean devolver,boolean alquilar1, boolean devolver1,int nkm) {

super(mar, matricula, va, mar1, matricula1, alquilado1);

this.alquilar = alquilar;

this.alquilar1 = alquilar1;

this.devolver = devolver;

this.devolver1 = devolver1;

this.numeroskm=nkm;

}

public void al(int a){

if(a==1) {

if(this.alquilar==false){

System.out.println("SI SE PUEDE ALQUILAR EL PRIMER CAMION");

}else  System.out.println("PRIMER CAMION NO DISPONIBLE");

if(this.alquilar1==false){

System.out.println("SEGUNDO CAMION DISPONIBLE");

}else  System.out.println("SEGUNDO CAMION NO DISPONIBLE");

Page 9: Java Netbeans

System.out.println("preparando para alquilar");

System.out.println("cual de los veiculos desea alquilar 1/2");

this.DatosInformativos();

this.datos();

}}

public void definir(int maa, int f){

if(maa==1){

if(this.alquilar==false){

System.out.println("SI SE PUEDE ALQUILAR EL PRIMER CAMION");System.out.println("a escojido");

this.alquilar=true;

this.DatosInformativos();

this.numeroskm=f;

}else  System.out.println("PRIMER CAMION NO DISPONIBLE");

}

else {

this.numeroskm=0;

if(this.alquilar1==false){

System.out.println("SEGUNDO CAMION DISPONIBLE");

System.out.println("a escojido");

this.alquilar1=true;

this.numeroskm=f;

this.datos();

Page 10: Java Netbeans

}else  System.out.println("SEGUNDO CAMION NO DISPONIBLE"); }

}

public void devo(int v){

if(v==1){

if(this.alquilar==true){

System.out.println("desea devolver este camion presione 1");

this.DatosInformativos();}

else if(this.alquilar1==true){

System.out.println(" DESEA DEVOLVER ESTE CAMION PRESIONE 2");

this.datos();}

}}

public void de(int devol,int d){

int valor=0;

if(devol==1){

this.alquilar=false;

System.out.println("SU CAMION ESTA CIENDO DEVOLVIDO");

valor=(d-this.numeroskm)*20;

System.out.println("SU CUENTA A PAGAR ES..."+valor+"$");

}else{ this.alquilar1=false;

System.out.println("SU CAMION ESTA CIENDO DEVOLVIDO");

valor=(d-this.numeroskm)*40;

Page 11: Java Netbeans

System.out.println("SU CUENTA A PAGAR ES..."+valor+"$");

}

}

@Override

public void datos() {

super.datos();

if(this.alquilar1==true){

System.out.println(" YA ESTA ALQUILADO");

System.out.println("arranco con  "+this.numeroskm+" dias");

}

else System.out.println("DISPONIBLE");

}

@Override

public void DatosInformativos() {

super.DatosInformativos();

if(this.alquilar==true){

System.out.println(" YA ESTA ALQUILADO");

System.out.println("arranco con  "+this.numeroskm+" dias");

}

else System.out.println("DISPONIBLE");

}

}

Page 12: Java Netbeans

Clase padre “turismo”:

public class turismo

{

private String marca;

private String matricula;

private int alquilado;

private String marca1;

private String matricula1;

private int alquilado1;

public turismo(String marca,String matricula, int alquilado,String marca1,String matricula1, int alquilado1) {

this.marca=marca;

this.matricula = matricula;

this.alquilado = alquilado;

this.marca1=marca1;

this.matricula1 = matricula1;

this.alquilado1 = alquilado1;

}

public void DatosInformativos()

{

System.out.println("buses para turismo");

System.out.println("tipo de bus: " + this.marca);

Page 13: Java Netbeans

System.out.println("#1  "+"matricula: " + this.matricula);

System.out.println("valor por KM   $"+this.alquilado);

}

public void datos(){

System.out.println("tipo de bus: " + this.marca1);

System.out.println("#2  "+"matricula: " + this.matricula1);

System.out.println("valor por KM"+this.alquilado1);

}

}

Clase hijo “turi”:

public class tur extends turismo

{

private boolean alquilar;

private boolean alquilar1;

private int numeroskm;

private boolean devolver;

private boolean devolver1;

public tur(String marca, String matricula, int alquilado, String marca1, String matricula1, int alquilado1, boolean alquilar, boolean alquilar1,  boolean devolver, boolean devolver1,int numeroskm) {

Page 14: Java Netbeans

super(marca, matricula, alquilado, marca1, matricula1, alquilado1);

this.alquilar = alquilar;

this.alquilar1 = alquilar1;

this.numeroskm = numeroskm;

this.devolver = devolver;

this.devolver1 = devolver1;

}

public void al(int a){

if(a==1) {

if(this.alquilar==false){

System.out.println("SI SE PUEDE ALQUILAR EL PRIMER CAMION");

}else  System.out.println("PRIMER CAMION NO DISPONIBLE");

if(this.alquilar1==false){

System.out.println("SEGUNDO CAMION DISPONIBLE");

}else  System.out.println("SEGUNDO CAMION NO DISPONIBLE");

System.out.println("preparando para alquilar");

System.out.println("cual de los veiculos desea alquilar 1/2");

this.DatosInformativos();

this.datos();

}}

public void definir(int maa, int f){

Page 15: Java Netbeans

if(maa==1){

if(this.alquilar==false){

System.out.println("SI SE PUEDE ALQUILAR EL PRIMER CAMION");

System.out.println("a escojido");

this.alquilar=true;

this.numeroskm=f;

this.DatosInformativos();

}else  System.out.println("PRIMER CAMION NO DISPONIBLE");

}

else {

this.numeroskm=0;

if(this.alquilar1==false){

System.out.println("SEGUNDO CAMION DISPONIBLE");

System.out.println("a escojido");

this.alquilar1=true;

this.numeroskm=f;

this.datos();

}else  System.out.println("SEGUNDO CAMION NO DISPONIBLE"); }

}

public void devo(int v){

if(v==1){

Page 16: Java Netbeans

if(this.alquilar==true){

System.out.println("desea devolver este camion presione 1");

this.DatosInformativos();}

else if(this.alquilar1==true){

System.out.println(" DESEA DEVOLVER ESTE CAMION PRESIONE 2");

this.datos();}

}}

public void de(int devol,int d){

int valor=0;

if(devol==1){

this.alquilar=false;

System.out.println("SU CAMION ESTA CIENDO DEVOLVIDO");

valor=(d-this.numeroskm)*2;

System.out.println("SU CUENTA A PAGAR ES..."+valor+"$");

}else{ this.alquilar1=false;

System.out.println("SU CAMION ESTA CIENDO DEVOLVIDO");

valor=(d-this.numeroskm)*3;

System.out.println("SU CUENTA A PAGAR ES..."+valor+"$");

}

}

@Override

public void datos() {

Page 17: Java Netbeans

super.datos();

if(this.alquilar1==true){

System.out.println(" YA ESTA ALQUILADO");

System.out.println("arranco con  "+this.numeroskm+" KM");

}

else System.out.println("DISPONIBLE");

}

@Override

public void DatosInformativos() {

super.DatosInformativos();

if(this.alquilar==true){

System.out.println(" YA ESTA ALQUILADO");

System.out.println("arranco con  "+this.numeroskm+" KM");

}else System.out.println("DISPONIBLE");}}

Este programa realiza las el funcionamiento de una biblioteca

A continuación su código:

Clase principal:import java.io.*;      

public class Principal {

public static InputStreamReader L=new InputStreamReader(System.in);

public static BufferedReader T=new BufferedReader(L);

Page 18: Java Netbeans

public static void main(String[] args) throws IOException{

publi car1 = new publi("","",0,"","",0,"","",0);

int op=0;

linros aa=new linros("java","edt1",20,"java1","edt2", 30,"java3","edt3",30,10,10,10,false,false,false);

revista re=new revista("LA ONDA","EDIT",20,"JUVENIL","edt2", 30,"COMIC","edt3",30,10,10,10,false,false,false);

do{

System.out.println("*********       BIBLIOTEKA         *********");

System.out.println("*********   1. PRESTAR UN LIBRO    *********");

System.out.println("********* 2. PRESTAR UNA REVIST    *********");

System.out.println("*********  3.DEBOLVER LIBRO        *********");

System.out.println("********* 4.DEBOLVER REVISTA       *********");

System.out.println("*********     5.IMFORMACION        *********");

System.out.println("*********        6.SALIR            *********");

op=Integer.parseInt(T.readLine());

switch(op){

case 1:

Page 19: Java Netbeans

System.out.println("PRESIONE  1 PARA PRESTAR CASO CONTRARIO 0");

int a=Integer.parseInt(T.readLine());

aa.al(a);

System.out.println("CUAL DESEA PRESTAR 1/2/3");

int aaa=Integer.parseInt(T.readLine());

System.out.println("CUANTAS COPIAS DESEA");

int aaaa=Integer.parseInt(T.readLine());

aa.definir(aaa,aaaa);

break;

case 2:

System.out.println("PRESIONE  1 PARA PRESTAR CASO CONTRARIO 0");

int ga=Integer.parseInt(T.readLine());

re.al(ga);

System.out.println("CUAL DESEA PRESTAR 1/2/3");

int sa=Integer.parseInt(T.readLine());

System.out.println("CUANTAS COPIAS DESEA");

int da=Integer.parseInt(T.readLine());

re.definir(sa,da);

break;

case 3:

Page 20: Java Netbeans

System.out.println("DESEA DEVOLVER LOS LIBROS 1/0");

int e=Integer.parseInt(T.readLine());

aa.devo(e);

System.out.println("CUAL DESEA DEVOLVER 1/2/3");

int r=Integer.parseInt(T.readLine());

System.out.println("CUANTAS COPIAS DEVUELVE ");

int rr=Integer.parseInt(T.readLine());

aa.de(r, rr);

break;

case 4:

System.out.println("DESEA DEVOLVER LOS LIBROS 1/0");

int es=Integer.parseInt(T.readLine());

re.devo(es);

System.out.println("CUAL DESEA DEVOLVER 1/2/3");

int rev=Integer.parseInt(T.readLine());

System.out.println("CUANTAS COPIAS DEVUELVE ");

int revi=Integer.parseInt(T.readLine());

aa.de(rev, revi);

break;

case 5:

System.out.println("/////////INFORMACION DE LIBROS/////////");

aa.Datos1();

Page 21: Java Netbeans

aa.datos2();

aa.datos3();

System.out.println("/////////INFORMACION DE REVISTAS/////////////////");

re.Datos1();

re.datos2();

re.datos3();

break;

}

}while(op!=6); }}

Clase padre:public class publi

{

private String nombre;

private String editorial;

private int numcopi;

private String nombre1;

private String editorial1;

private int numcopi1;

private String nombre2;

private String editorial2;

private int numcopi2;

Page 22: Java Netbeans

public publi( String nombre, String editorial, int numcopi, String nombre1, String editorial1, int numcopi1, String nombre2, String editorial2, int numcopi2) {

this.nombre = nombre;

this.editorial = editorial;

this.numcopi = numcopi;

this.nombre1 = nombre1;

this.editorial1 = editorial1;

this.numcopi1 = numcopi1;

this.nombre2 = nombre2;

this.editorial2 = editorial2;

this.numcopi2 = numcopi2;

}

public void Datos1()

{

System.out.println("");

System.out.println("NOMBRE :   " + this.nombre);

System.out.println("NOMBRE DE LA EDITORIAL: " + this.editorial);

System.out.println("NUMERO DE PUBLICACIONES:  "+this.numcopi);

}

public void datos2(){

System.out.println("");

Page 23: Java Netbeans

System.out.println("NOMBRE :   " + this.nombre1);

System.out.println("NOMBRE DE LA EDITORIAL: " + this.editorial1);

System.out.println("NUMERO DE PUBLICACIONES:  "+this.numcopi1);

}

public void datos3(){

System.out.println("");

System.out.println("NOMBRE :   " + this.nombre2);

System.out.println("NOMBRE DE LA EDITORIAL: " + this.editorial2);

System.out.println("NUMERO DE PUBLICACIONES:  "+this.numcopi2);

}

}

Clase hija:import java.io.*;

public class linros extends publi

{

public static InputStreamReader Leer = new InputStreamReader(System.in);

public static BufferedReader Teclado = new BufferedReader(Leer);

Page 24: Java Netbeans

private int numcopias;

private int numcopias1;

private int numcopias2;

private boolean prestar;

private boolean prestar1;

private boolean prestar2;

public linros(String nombre, String editorial, int numcopi, String nombre1, String editorial1, int numcopi1, String nombre2, String editorial2, int numcopi2, int numcopias, int numcopias1, int numcopias2, boolean prestar, boolean prestar1, boolean prestar2) {

super(nombre, editorial, numcopi, nombre1, editorial1, numcopi1, nombre2, editorial2, numcopi2);

this.numcopias = numcopias;

this.numcopias1 = numcopias1;

this.numcopias2 = numcopias2;

this.prestar = prestar;

this.prestar1 = prestar1;

this.prestar2 = prestar2;

}

public void al(int a){

if(a==1) {

if(this.numcopias>1){

System.out.println("SI SE PUEDE PRESTAR ");

Page 25: Java Netbeans

this.Datos1();

}else  System.out.println("NO SE PUEDE PRESTAR ");

if(this.numcopias1>1){

System.out.println("SI SE PUEDE PRESTAR ");

this.datos2();

}else  System.out.println("NO SE PUEDE PRESTAR ");

if(this.numcopias2>1){

System.out.println("SI SE PUEDE PRESTAR ");

this.datos3();

}else  System.out.println("NO SE PUEDE PRESTAR ");

}}

public void definir(int maa, int f){

if((maa==1)&&(f<=this.numcopias)){

System.out.println("A ESCOJIDO EL LIBRO ");

this.numcopias-=f;

this.prestar=true;

this.Datos1();

}else System.out.println("no hay suficientes copias ");

if((maa==2)&&(f<=this.numcopias1)){

System.out.println("A ESCOJIDO EL LIBRO ");

this.numcopias1-=f;

Page 26: Java Netbeans

this.prestar1=true;

this.datos2();

//System.out.println("LIBRO PRESTADO ");

}else System.out.println("no hay suficientes copias ");

if((maa==3)&&(f<=this.numcopias2)){

System.out.println("A ESCOJIDO EL LIBRO ");

this.numcopias2-=f;

this.prestar2=true;

this.datos3();

}else System.out.println("no hay suficientes copias ");

}

public void devo(int v){

if(v==1){

if(this.prestar==true){

this.Datos1();

}

if(this.prestar1==true){

this.datos2();

}

if(this.prestar2==true){

this.datos3();

}

Page 27: Java Netbeans

}  }

public void de(int devol,int d){

if(devol==1){

System.out.println("PRESIONE 1 PARA DEVOLVER ESTE LIBRO ");

this.prestar=false;

this.numcopias+=d;

System.out.println("LIBRO DEVUELTO A BIBLIOTEKA ");

}

if(devol==2){ System.out.println("PRESIONE 2 PARA DEVOLVER ESTE LIBRO ");

this.prestar1=false;

this.numcopias1+=d;

System.out.println("LIBRO DEVUELTO A BIBLIOTEKA ");

}

if(devol==3){ System.out.println("PRESIONE 3 PARA DEVOLVER ESTE LIBRO ");

this.prestar2=false;

this.numcopias2+=d;

System.out.println("LIBRO DEVUELTO A BIBLIOTEKA ");

}}

@Override

public void Datos1() {

super.Datos1();

Page 28: Java Netbeans

System.out.println("QUEDAN "+this.numcopias+"LIBRO ");

if(this.prestar==true)

System.out.println("LIBRO PRESTADO ");

else System.out.println("LIBRO DISPONIBLE ");

}

@Override

public void datos2() {

super.datos2();

System.out.println("QUEDAN "+this.numcopias1+"LIBRO ");

if(this.prestar1==true)

System.out.println("LIBRO PRESTADO ");

else System.out.println("LIBRO DISPONIBLE ");

}

@Override

public void datos3() {

super.datos3();

System.out.println("QUEDAN "+this.numcopias2+"LIBRO ");

if(this.prestar2==true)

System.out.println("LIBRO PRESTADO ");

else System.out.println("LIBRO DISPONIBLE ");

}

}

Page 29: Java Netbeans

Clase hija 2: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 int numcopias1;

private int numcopias2;

private boolean prestar;

private boolean prestar1;

private boolean prestar2;

public revista(String nombre, String editorial, int numcopi, String nombre1, String editorial1, int numcopi1, String nombre2, String editorial2, int numcopi2, int numcopias, int numcopias1, int numcopias2, boolean prestar, boolean prestar1, boolean prestar2) {

super(nombre, editorial, numcopi, nombre1, editorial1, numcopi1, nombre2, editorial2, numcopi2);

this.numcopias = numcopias;

this.numcopias1 = numcopias1;

this.numcopias2 = numcopias2;

this.prestar = prestar;

Page 30: Java Netbeans

this.prestar1 = prestar1;

this.prestar2 = prestar2;

}

public void al(int a){

if(a==1) {

if(this.numcopias>1){

System.out.println("SI SE PUEDE PRESTAR ");

this.Datos1();

}else  System.out.println("NO SE PUEDE PRESTAR ");

if(this.numcopias1>1){

System.out.println("SI SE PUEDE PRESTAR ");

this.datos2();

}else  System.out.println("NO SE PUEDE PRESTAR ");

if(this.numcopias2>1){

System.out.println("SI SE PUEDE PRESTAR ");

this.datos3();

}else  System.out.println("NO SE PUEDE PRESTAR ");}}

public void definir(int maa, int f){

if((maa==1)&&(f<=this.numcopias)){

System.out.println("A ESCOJIDO EL REVISTA ");

this.Datos1();

this.numcopias-=f;

Page 31: Java Netbeans

this.prestar=true;

}else System.out.println("no hay suficientes copias ");

if((maa==2)&&(f<=this.numcopias1)){

System.out.println("A ESCOJIDO EL REVISTA ");

this.numcopias1-=f;

this.prestar1=true;

this.datos2();

//System.out.println("REVISTA PRESTADO ");

}else System.out.println("no hay suficientes copias ");

if((maa==3)&&(f<=this.numcopias2)){

System.out.println("A ESCOJIDO EL REVISTA ");

this.numcopias2-=f;

this.prestar2=true;

this.datos3();

}else System.out.println("no hay suficientes copias ");

}

public void devo(int v){

if(v==1){

if(this.prestar==true){

this.Datos1();

}

if(this.prestar1==true){

Page 32: Java Netbeans

this.datos2();

}

if(this.prestar2==true){

this.datos3();

}

}  }public void de(int devol,int d){

int valor=0;

if(devol==1){

System.out.println("PRESIONE 1 PARA DEVOLVER ESTA REVISTA ");

this.prestar=false;

this.numcopias+=d;

System.out.println("REVISTA DEVUELTO A BIBLIOTEKA ");

}

if(devol==2){

System.out.println("PRESIONE 2 PARA DEVOLVER ESTA REVISTA ");

this.prestar1=false;

this.numcopias1+=d;

System.out.println("REVISTA DEVUELTO A BIBLIOTEKA ");

}

if(devol==3){

Page 33: Java Netbeans

System.out.println("PRESIONE 3 PARA DEVOLVER ESTA REVISTA ");

this.prestar2=false;

this.numcopias2+=d;

System.out.println("REVISTA DEVUELTO A BIBLIOTEKA ");

}

}

@Override

public void Datos1() {

super.Datos1();

System.out.println("QUEDAN "+this.numcopias+"LIBRO ");

if(this.prestar1==true)

System.out.println("LIBRO PRESTADO ");

else System.out.println("LIBRO DISPONIBLE ");

}

@Override

public void datos2() {

super.datos2();

System.out.println("QUEDAN "+this.numcopias1+"LIBRO ");

if(this.prestar1==true)

System.out.println("LIBRO PRESTADO ");

else System.out.println("LIBRO DISPONIBLE ");

}

Page 34: Java Netbeans

@Override

public void datos3() {

super.datos3();

System.out.println("QUEDAN "+this.numcopias2+"LIBRO ");

if(this.prestar1==true)

System.out.println("LIBRO PRESTADO ");else System.out.println("LIBRO DISPONIBLE ");}}