Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Facultad de Ciencias
ESCUELA DE INFORMATICA
Proyecto Final de la Materia Estructura de Datos INF 5260 - 01
Presentado por:
#include "SistemaVuelos.h"
#include<stdlib.h>
#include<cctype>
//#include<vector>
// using namespace std;
void start(){
char respuesta = ' ';
string 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>
class SistemaVuelos{
class Tabla{
public:
int idTabla;
string nombre_tabla;
class Columna{
public:
int id_columna;
int idTabla;
int col_numero;
string col_nombre;
string 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;
class Foranea_Asoc{
public:
int id_asoc;
int id_tabla_padre;
int 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;
//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;
//Getters
int getIdPer(){ return id_per; }
string getNombre(){ return nombre; }
string getPasaporte(){ return pass; }
};
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; }
};
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;
}
class Aeropuerto{
private:
int id_aeropuerto;
string nombre_aeropuerto;
string ciudad_aeropuerto;
vector<int> a;
public:
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;
};
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:
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";
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();
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();
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;
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";
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";
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();
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";
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();
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();
}