Está en la página 1de 22

UNIVERSIDAD AUTÓNOMA DE SANTO DOMINGO

Primada de América ∙ Fundada el 28 de Octubre de 1538

Facultad de Ciencias
ESCUELA DE INFORMATICA
Proyecto Final de la Materia Estructura de Datos INF 5260 - 01

Presentado por:

Luis Angel Hernandez Perdomo


100249439

Profesor: Silverio del Orbe


/*
NOMBRE COMPLETO: LUIS ANGEL HERNANDEZ PERDOMO
MATRICULA: 100249439
PROFESOR: SILVERIO DEL ORBE
MATERIA: ESTRUCTURAS DE DATOS
*/

#include "SistemaVuelos.h"
#include<stdlib.h>
#include<cctype>

//#include<vector>
// using namespace std;

void start(){
char respuesta = ' ';
string temp = "0";

SistemaVuelos *sis = new SistemaVuelos();


do{
respuesta = ' ';
system("cls");
cout << "SISTEMA DE VUELOS "
<< "\nSeleccione Opcion + ENTER"
<< " \nA. VUELOS"
<< " \nB. AEROPUERTOS"
<< " \nC. AEROLINEAS"
<< " \nD. EMPLEADOS"
<< " \nX. SALIR"
<< " \n";

cin >> temp;


respuesta = tolower(temp[0]);

switch (respuesta){
case 'a':
sis->vuelos();
break;
case 'b':
sis->losAeropuertos();
break;
case 'c':
sis->lasAerolineas();
break;
case 'd':
sis->EMPLEADOS();
break;
default:

break;
}
} while (respuesta != 'x');
}

int main(){
start();
return 0;
}
SistemaVuelos.h

/*
NOMBRE COMPLETO: LUIS ANGEL HERNANDEZ PERDOMO
MATRICULA: 100249439
PROFESOR: SILVERIO DEL ORBE
MATERIA: ESTRUCTURAS DE DATOS
*/

#include<iostream>
#include<string>
#include<vector>
#include<fstream>

using namespace std;

class SistemaVuelos{

class Tabla{
public:
int idTabla;
string nombre_tabla;

Tabla(int idTabla, string nombre_tabla){


this->idTabla = idTabla;
this->nombre_tabla = nombre_tabla;
}

int mostrarIDTabla(){ return idTabla; }


string getNombreTabla(){ return nombre_tabla; }
};

class Columna{
public:
int id_columna;
int idTabla;
int col_numero;
string col_nombre;
string col_tipo;

Columna(int id_columna, int idTabla, int col_numero, string


col_nombre, string col_tipo){
this->id_columna = id_columna;
this->idTabla = idTabla;
this->col_numero = col_numero;
this->col_nombre = col_nombre;
this->col_tipo = col_tipo;
}

//GETTERS
int getIdColumna(){ return id_columna; }
int mostrarIDTabla(){ return idTabla; }
int getColNumero(){ return col_numero; }
string getColNombre(){ return col_nombre; }
string getColTipo(){ return col_tipo; }
};

class Primaria{
public:
int id_primaria;
int idTabla;
int id_columna;

Primaria(int id_primaria, int idTabla, int id_columna){


this->id_primaria = id_primaria;
this->idTabla = idTabla;
this->id_columna = id_columna;
}

int getIdPrimaria(){ return id_primaria; }


int mostrarIDTabla(){ return idTabla; }
int getIdColumna(){ return id_columna; }
};

class Foranea_Asoc{
public:
int id_asoc;
int id_tabla_padre;
int id_tabla_hijo;

Foranea_Asoc(int id_asoc, int id_tabla_padre, int id_tabla_hijo){


this->id_asoc = id_asoc;
this->id_tabla_padre = id_tabla_padre;
this->id_tabla_hijo = id_tabla_hijo;
}

//GETTERS
int getIdAsoc(){ return id_asoc; }
int mostrarIDTablaPadre(){ return id_tabla_padre; }
int mostrarIDTablaHijo(){ return id_tabla_hijo; }
};

class Foranea_Col{
public:
int id_foranea;
int id_col_tabla_padre;
int id_col_tabla_hijo;

Foranea_Col(int id_foranea, int id_col_tabla_padre, int


id_col_tabla_hijo){
this->id_foranea = id_foranea;
this->id_col_tabla_padre = id_col_tabla_padre;
this->id_col_tabla_hijo = id_col_tabla_hijo;
}

//GETTERS
int getIdForanea(){ return id_foranea; }
int getIdColTablaPadre(){ return id_col_tabla_padre; }
int getIdColTablaHijo(){ return id_col_tabla_hijo; }
};
class Persona{
protected:
int id_per;
string nombre;
string pass;

Persona(int id_per, string nombre, string pass){


this->id_per = id_per;
this->nombre = nombre;
this->pass = pass;
}

//Getters
int getIdPer(){ return id_per; }
string getNombre(){ return nombre; }
string getPasaporte(){ return pass; }
};

class Pasajero : public Persona{


private:
int id_pass;
int id_vuelo;

public:
Pasajero(int id_per, string nombre, string pass, int id_pass, int
id_vuelo) :
Persona(id_per, nombre, pass){
this->id_pass = id_pass;
this->id_vuelo = id_vuelo;
}

//Getters
int getIdPass(){ return id_pass; }
int getIdVuelo(){ return id_vuelo; }
};

class Empleado : public Persona{


private:
int id_empleado;
int id_aerolinea;

public:
Empleado(int id_per, string nombre, string pass, int id_empleado,
int id_aerolinea) :
Persona(id_per, nombre, pass){
this->id_empleado = id_empleado;
this->id_aerolinea = id_aerolinea;
}

//Getters
int getIdEmpleado(){ return id_empleado; }
int getIdAerolinea(){ return id_aerolinea; }
};

class Boleto{
private:
int id;
int id_vuelo;
int id_pasajero;
int asiento_avion;
public:
Boleto(int id, int id_vuelo, int id_pasajero, int asiento_avion){
this->id = id;
this->id_vuelo = id_vuelo;
this->id_pasajero = id_pasajero;
this->asiento_avion = asiento_avion;
}

int getID(){ return id; }


int getIDVuelo(){ return id_vuelo; }
int getIDPasajero(){ return id_pasajero; }
int getIDAsientoAvion(){ return asiento_avion; }

bool registrarBoleto(){ return true; }


};

class Aeropuerto{
private:
int id_aeropuerto;
string nombre_aeropuerto;
string ciudad_aeropuerto;

vector<int> a;
public:
Aeropuerto(){}

Aeropuerto(int id_aeropuerto, string nombre_aeropuerto, string


ciudad_aeropuerto){
this->id_aeropuerto = id_aeropuerto;
this->nombre_aeropuerto = nombre_aeropuerto;
this->ciudad_aeropuerto = ciudad_aeropuerto;

int getIdAeropuerto(){ return id_aeropuerto; }


string getnombreAeropuerto(){ return nombre_aeropuerto; }
string getCiudadAeropuerto(){ return ciudad_aeropuerto; }

};

class Aerolinea{
private:
int id_aerolinea;
string nombre_aerolinea;

public:

Aerolinea(){}
Aerolinea(int id_aerolinea, string nombre_aerolinea){
this->id_aerolinea = id_aerolinea;
this->nombre_aerolinea = nombre_aerolinea;

int getIdAerolinea(){ return id_aerolinea; }


string getNombreAerolinea(){ return nombre_aerolinea; }

};

class Vuelo{
private:
int id_vuelo;
vector<Pasajero> pasajeros;
Aerolinea aerolinea;
Aeropuerto aeropuerto_origen;
Aeropuerto aeropuerto_destino;
string fecha;
string hora_salida;
string hora_llegada;
public:

Vuelo(int id_vuelo, vector<Pasajero> pasajeros, Aerolinea


aerolinea, Aeropuerto aeropuerto_origen, Aeropuerto aeropuerto_destino, string
fecha, string hora_salida, string hora_llegada){
this->id_vuelo = id_vuelo;
this->pasajeros = pasajeros;
this->aerolinea = aerolinea;
this->aeropuerto_origen = aeropuerto_origen;
this->aeropuerto_destino = aeropuerto_destino;
this->fecha = fecha;
this->hora_salida = hora_salida;
this->hora_llegada = hora_llegada;
}

int getIdVuelo(){ return id_vuelo; }


vector<Pasajero> getPasajeros(){ return pasajeros; }

string getFecha(){ return fecha; }


string getHoraSalida(){ return hora_salida; }
string getHoraLlegada(){ return hora_llegada; }
};

private:
vector<Tabla> tablas;
vector<Columna> columnas;
vector<Primaria> primarias;
vector<Foranea_Asoc> foranea_asociaciones;
vector<Foranea_Col> foranea_columnas;
vector<Aeropuerto> aeropuertos;
vector<Aerolinea> aerolineas;

bool consultarTabla(string);
bool consultarPrimaria(int);
bool consultarForaneaAsoc(string, string);
bool consultarForaneaCol(int);

public:

void anadirpasajero();
void listarPasajeros();

void losEmpleados();
void listarEmpleados();
void agregarEmpleados();

void vuelos();
void hacervuelos();
void AlistarVuelos();
void AlistarBoletos();
void retornarboleto();

void losAeropuertos();
void agregarAeropuertos();
void listarAeropuertos();

void lasAerolineas();
void agregarAerolineas();
void listarAerolineas();
};

SistemaVuelo.cpp
#include"SistemaVuelos.h"

void SistemaVuelos::anadirpasajero(){
cout << "ID PASAJERO: ";
getchar();
cout << " \nID VUELO: ";
getchar();
cout << " \nNOMBRE: ";
getchar();
cout << " \nPASAPORTE: ";
getchar();
cout << " \nASIENTO: ";
getchar();
}

void SistemaVuelos::listarPasajeros(){
system("cls");

int codigo_vuelo = 0;
cout << "SISTEMA DE VUELOS "
<< "\nLISTADO DE PASAJEROS DE VUELO"
<< "\nINGRESE CODIGO DEL VUELO: ";
cin >> codigo_vuelo;
cout << "\nPASAJEROS: " << endl;
getchar();
}

void SistemaVuelos::losEmpleados(){
char respuesta = ' ';
string temp = "0";
do{
respuesta = ' ';
system("cls");
cout << "SISTEMA DE VUELOS "
<< "\nEMPLEADOS"
<< " \nA. LISTAR EMPLEADOS"
<< " \nB. AGREGAR EMPELADOS"
<< " \nX. SALIR"
<< " \n\n\t\t";

cin >> temp;


respuesta = tolower(temp[0]);

switch (respuesta){
case 'a':
listarEmpleados();
break;
case 'b':
agregarEmpleados();
break;
default:

break;
}
} while (respuesta != 'x');
}

void SistemaVuelos::listarEmpleados(){
system("cls");
cout << "SISTEMA DE VUELOS "
<< "\nLISTADO DE EMPLEADOS";
getchar();
}

void SistemaVuelos::agregarEmpleados(){
char respuesta = ' ';
string temp = "0";
do{
respuesta = ' ';
temp = "0";
system("cls");
cout << "SISTEMA DE VUELOS "
<< "\nREGISTRO DE EMPLEADO"
<< " \nID DEL EMPLEADO: ";
getchar();
cout << "SELECCIONE AEROLINEA: ";
getchar();
cout << "NOMBRE: ";
getchar();
cout << "PASAPORTE: ";
getchar();

cout << "\nOTRO EMPLEADO? (S/N): \n";

while (temp[0] != 's' & temp[0] != 'S' & temp[0] != 'n' & temp[0]
!= 'N'){
cout << "\t\t";
cin >> temp;
}
respuesta = tolower(temp[0]);
} while (respuesta != 'n');
}

void SistemaVuelos::vuelos(){
char respuesta = ' ';
string temp = "0";
do{
respuesta = ' ';
temp = "0";
system("cls");
cout << "SISTEMA DE VUELOS "
<< "\nVUELOS"
<< " \nA. PROGRAMAR UN VUELO"
<< " \nB. LISTAR VUELOS"
<< " \nC. LISTAR BOLETOS"
<< " \nD. DEVOLVER UN BOLETO"
<< " \nX. SALIR"
<< " \n\n\t\t";
cin >> temp;
respuesta = tolower(temp[0]);

switch (respuesta){
case 'a':
hacervuelos();
break;
case 'b':
AlistarVuelos();
break;
case 'c':
AlistarBoletos();
break;
case 'd':
retornarboleto();
break;
default:

break;
}
} while (respuesta != 'x');
}

void SistemaVuelos::hacervuelos(){
char respuesta = ' ';
string temp = "0";
do{
respuesta = ' ';
temp = "0";
system("cls");
cout << "SISTEMA DE VUELOS "
<< "\nPROGRAMACION DE VUELOS"
<< " \nID DEL VUELO: ";
getchar();
cout << "LISTA DE AEROPUERTOS ...";
cout << "\nID AEROPUERTO ORIGEN: ";
getchar();
cout << "\nID AEROPUERTO DESTINO: ";
getchar();
cout << "\nID AEROLINEA: ";
getchar();
cout << "\nFECHA: ";
getchar();
cout << "\nCAPACIDAD: ";
getchar();
cout << "\nHORA SALIDA: ";
getchar();
cout << "\nHORA LLEGADA: ";
getchar();

cout << "\nOTRO VUELO? (S/N): \n";

while (temp[0] != 's' & temp[0] != 'S' & temp[0] != 'n' & temp[0]
!= 'N'){
cout << "\t\t";
cin >> temp;
}
respuesta = tolower(temp[0]);
} while (respuesta != 'n');
}
void SistemaVuelos::AlistarVuelos(){
char respuesta = ' ';
string temp = " ";

system("cls");
cout << "SISTEMA DE VUELOS "
<< "\nLISTADO DE VUELOS";
// getchar();
cout << "\nSELECCIONE OPCION DESEADA:"
"\n1. COMPRAR UN BOLETO"
"\n2. LISTAR PASAJEROS DE UN VUELO"
"\n0. SALIR" << endl;

while (temp[0] != '1' & temp[0] != '2' & temp[0] != '0'){


cout << "\t\t";
cin >> temp;
}
respuesta = tolower(temp[0]);

switch (respuesta){
case '1':
anadirpasajero();
break;
case '2':
listarPasajeros();
break;
case '0':

break;
}
}

void SistemaVuelos::AlistarBoletos(){
system("cls");
cout << "SISTEMA DE VUELOS "
<< "\nLISTADO DE BOLETOS";
getchar();
}

void SistemaVuelos::retornarboleto(){
char respuesta = ' ';
string temp = "0";
system("cls");
cout << "SISTEMA DE VUELOS "
<< "\nDEVUELTA DE BOLETO";

cout << "\nINGRESE ID DEL BOLETO: ";


getchar();

cout << "\nSEGURO DE DEVOLVER? (S/N) \n";


while (temp[0] != 's' & temp[0] != 'S' & temp[0] != 'n' & temp[0] != 'N'){
cout << "\t\t";
cin >> temp;
}

void SistemaVuelos::losAeropuertos(){
char respuesta = ' ';
string temp = "0";
do{
respuesta = ' ';
system("cls");
cout << "\nSISTEMA DE VUELOS "
<< "\nAEROPUERTOS"
<< " \nA. AGREGAR AEROPUERTOS"
<< " \nB. LISTAR AEROPUERTOS"
<< " \nX. SALIR"
<< " \n\n\t\t";

cin >> temp;


respuesta = tolower(temp[0]);

switch (respuesta){
case 'a':
agregarAeropuertos();
break;
case 'b':
listarAeropuertos();
break;
default:

break;
}
} while (respuesta != 'x');
}

void SistemaVuelos::agregarAeropuertos(){
char respuesta = ' ';
string temp = "0";
do{
respuesta = ' ';
temp = "0";
system("cls");
cout << "SISTEMA DE VUELOS "
<< "\nAGREGAR AEROPUERTOS"
<< " \nID DEL AEROPUERTO: ";
getchar();
cout << "\nNOMBRE: ";
getchar();
cout << "\nCIUDAD: ";
getchar();

cout << "\nOTRO AEROPUERTO? (S/N): \n";

while (temp[0] != 's' & temp[0] != 'S' & temp[0] != 'n' & temp[0]
!= 'N'){
cout << "\t\t";
cin >> temp;
}
respuesta = tolower(temp[0]);
} while (respuesta != 'n');
}

void SistemaVuelos::listarAeropuertos(){
system("cls");
cout << "\SISTEMA DE VUELOS "
<< "\nLISTADO DE AEROPUERTOS";
getchar();
}

void SistemaVuelos::lasAerolineas(){
char respuesta = ' ';
string temp = "0";
do{
respuesta = ' ';
system("cls");
cout << "\nSISTEMA DE VUELOS "
<< "\nAEROLINEAS"
<< " \nA. AGREGAR AEROLINEAS"
<< " \nB. LISTAR AEROLINEAS"
<< " \nX. SALIR"
<< " \n\n\t\t";

cin >> temp;


respuesta = tolower(temp[0]);

switch (respuesta){
case 'a':
agregarAerolineas();
break;
case 'b':
listarAerolineas();
break;
default:

break;
}
} while (respuesta != 'x');
}

void SistemaVuelos::agregarAerolineas(){
char respuesta = ' ';
string temp = "0";
do{
respuesta = ' ';
temp = "0";
system("cls");
cout << "SISTEMA DE VUELOS "
<< "\nAGREGAR AEROLINEAS"
<< " \nID DE AEROLINEA: ";
getchar();
cout << "\nNOMBRE: ";
getchar();

cout << "\n\n\t\tOTRA AEROLINEA? (S/N): \n";

while (temp[0] != 's' & temp[0] != 'S' & temp[0] != 'n' & temp[0]
!= 'N'){
cout << "\t\t";
cin >> temp;
}
respuesta = tolower(temp[0]);
} while (respuesta != 'n');
}

void SistemaVuelos::listarAerolineas(){
system("cls");
cout << "SISTEMA DE VUELOS "
<< "\nLISTADO DE AEROLINEAS";
getchar();
}

También podría gustarte