JAVA NETBEANS
Enviado por LeeFox • 14 de Mayo de 2014 • Exámen • 765 Palabras (4 Páginas) • 268 Visitas
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....!");
//String Cargo, String Departamento,long Cedula, String Nombres, int Edad
turismo bus = new turismo("HINO","hj-345", 2,"CHEBROLET","hj-333", 3);
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 *********");
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:
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;
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();
...