Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Integrantes del equipo:
- //Fecha: 12 de noviembre de 2019
- //Descripción: Proyecto final
- #include<stdio.h>
- #include<wchar.h>
- #include<locale.h>
- #include<stdlib.h>
- #include<iostream>
- #include<string.h>
- #include "Libro.h"
- #include "Recargos.h"
- #include<conio.h>
- using namespace std;
- class Usuario : public Libro ,public Recargos{
- private:
- string Nombre;
- string Direccion;
- string Telefono;
- string FechaNacimiento;
- int Edad;
- public:
- void setNombre(string);
- void setDireccion(string);
- void setTelefono(string);
- void setFechaNacimiento(string);
- void setEdad(int);
- string obtenerNombre();
- string obtenerDireccion();
- string obtenerTelefono();
- string obtenerFechaNacimiento();
- int obtenerEdad();
- Usuario(string, string, string, string, int);
- void imprimir();
- };
- Usuario::Usuario(string _Nombre="Sin datos", string _Direccion="Sin datos", string _Telefono="Sin datos", string _FechaNacimiento="Sin datos",int _Edad=0){
- Nombre=_Nombre;
- Direccion=_Direccion;
- Telefono=_Telefono;
- FechaNacimiento=_FechaNacimiento;
- Edad=_Edad;
- }
- void Usuario::setNombre(string _Nombre){
- Nombre=_Nombre;
- }
- void Usuario::setDireccion(string _Direccion){
- Direccion=_Direccion;
- }
- void Usuario::setTelefono(string _Telefono){
- Telefono = _Telefono;
- }
- void Usuario::setFechaNacimiento(string _FechaNacimiento){
- FechaNacimiento=_FechaNacimiento;
- }
- void Usuario::setEdad(int _Edad){
- Edad = _Edad;
- }
- string Usuario::obtenerNombre(){
- return Nombre;
- }
- string Usuario::obtenerDireccion(){
- return Direccion;
- }
- string Usuario::obtenerTelefono(){
- return Telefono;
- }
- string Usuario::obtenerFechaNacimiento(){
- return FechaNacimiento;
- }
- int Usuario::obtenerEdad(){
- return Edad;
- }
- void Usuario::imprimir(){
- cout<<"Nombre: "<<Nombre<<endl;
- cout<<"Dirección: "<<Direccion<<endl;
- cout<<"Telefono: "<<Telefono<<endl;
- cout<<"Edad: "<<Edad<<endl;
- cout<<"Fecha de Nacimiento: "<<FechaNacimiento<<endl;
- cout<<"---------------------------------------"<<endl;
- }
- Usuario Lee1(){
- string _Nombre, _Direccion, _Telefono, _FechaNacimiento;
- int _Edad;
- cout<<"Ingrese su Nombre: ";
- cin>>_Nombre;
- cout<<"Ingrese su Edad: ";
- cin>>_Edad;
- cout<<"Ingrese su Dirección: ";
- cin>>_Direccion;
- cout<<"Ingrese su Fecha de Nacimiento: ";
- cin>>_FechaNacimiento;
- cout<<"Ingrese su Telefono: ";
- cin>>_Telefono;
- cout<<"_______________________________________"<<endl;
- Usuario Datos1( _Nombre, _Direccion, _Telefono, _FechaNacimiento, _Edad);
- return Datos1;
- }
- int main()
- {
- setlocale(LC_ALL, "");
- string contra, PC, UC;
- char res;
- int longitudC, opc,opc2;
- do
- {
- system("cls");
- cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
- cout<<"| Bienvenido al Sistema Bibliotecario |"<<endl;
- cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
- cout<<"\n~~~~~~ Introduzca su contraseña de acceso ~~~~~~"<<endl;
- cin>>contra;
- longitudC=contra.size();
- PC=contra.substr(0, 1);
- UC=contra.substr(longitudC-1,1);
- try
- {
- if(longitudC<6)
- throw 0;
- cout<<"Contaseña correcta"<<endl;
- cout<<"-------------------------------------------"<<endl;
- cout<<"-----------Servicios Disponibles-----------"<<endl;
- cout<<" 1.-Registro. "<<endl;
- cout<<" 2.-Prestamos. "<<endl;
- cout<<" 3.-Recargos. "<<endl;
- cout<<"-------------------------------------------"<<endl;
- cout<<"Seleccione una opción porfavor: ";
- cin>>opc;
- system("cls");
- switch(opc)
- {
- case 1:
- {
- cout<<"--------Ha ingresado al servicio de Registro--------"<<endl;
- Usuario Sujeto;
- Sujeto=Lee1();
- cout<<"-----------Usuario Registrado en la Base de Datos------------"<<endl<<endl;
- Sujeto.imprimir();
- break;
- }
- case 2:
- {
- cout<<"--------Ha ingresado al servicio de Prestamos--------"<<endl;
- cout<<"\nQue accion desea hacer?"<<endl;
- cout<<"1.- Registrar Libro"<<endl;
- cout<<"2.- Consultar Prestamo"<<endl;
- cin>>opc2;
- if(opc2==1){
- Libro Librito;
- Librito.Lee();
- cout<<"-----------Libro Registrado------------"<<endl<<endl;
- Librito.imprimir();
- }
- if(opc2==2){
- Libro Librito;
- Librito.Lee();
- Librito.imprimir();
- break;
- }
- }
- case 3:
- {
- cout<<"--------Ha ingresado al servicio de Recargos--------"<<endl;
- Recargos R1;
- R1.LeeDatos();
- cout<<"Usted tiene un recargo de: $ "<<R1.calcularecargos()<<endl;
- break;
- }
- }
- }
- catch (int error)
- {
- cout<<"------------------------------------------------------"<<endl;
- cout<<"Lo sentimos se ha dectectado un error."<<endl;
- if(error==0){
- cout<<"La contraseña debe de tener por lo menos 6 caracteres"<<endl;
- cout<<"Intentelo de nuevo. "<<endl;
- cout<<"------------------------------------------------------"<<endl;
- }
- }
- cout<<"Desea hacer otra operacion? S/N: ";
- cin>>res;
- }while((res=='S'||res=='s'));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement