Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.01 KB | None | 0 0
  1. //Integrantes del equipo:
  2. //Fecha: 12 de noviembre de 2019
  3. //Descripción: Proyecto final
  4. #include<stdio.h>
  5. #include<wchar.h>
  6. #include<locale.h>
  7. #include<stdlib.h>
  8. #include<iostream>
  9. #include<string.h>
  10. #include "Libro.h"
  11. #include "Recargos.h"
  12. #include<conio.h>
  13.  
  14. using namespace std;
  15. class Usuario : public Libro ,public Recargos{
  16. private:
  17. string Nombre;
  18. string Direccion;
  19. string Telefono;
  20. string FechaNacimiento;
  21. int Edad;
  22. public:
  23. void setNombre(string);
  24. void setDireccion(string);
  25. void setTelefono(string);
  26. void setFechaNacimiento(string);
  27. void setEdad(int);
  28. string obtenerNombre();
  29. string obtenerDireccion();
  30. string obtenerTelefono();
  31. string obtenerFechaNacimiento();
  32. int obtenerEdad();
  33. Usuario(string, string, string, string, int);
  34. void imprimir();
  35. };
  36. Usuario::Usuario(string _Nombre="Sin datos", string _Direccion="Sin datos", string _Telefono="Sin datos", string _FechaNacimiento="Sin datos",int _Edad=0){
  37. Nombre=_Nombre;
  38. Direccion=_Direccion;
  39. Telefono=_Telefono;
  40. FechaNacimiento=_FechaNacimiento;
  41. Edad=_Edad;
  42. }
  43.  
  44. void Usuario::setNombre(string _Nombre){
  45. Nombre=_Nombre;
  46. }
  47. void Usuario::setDireccion(string _Direccion){
  48. Direccion=_Direccion;
  49. }
  50. void Usuario::setTelefono(string _Telefono){
  51. Telefono = _Telefono;
  52. }
  53. void Usuario::setFechaNacimiento(string _FechaNacimiento){
  54. FechaNacimiento=_FechaNacimiento;
  55. }
  56. void Usuario::setEdad(int _Edad){
  57. Edad = _Edad;
  58. }
  59.  
  60. string Usuario::obtenerNombre(){
  61. return Nombre;
  62. }
  63. string Usuario::obtenerDireccion(){
  64. return Direccion;
  65. }
  66. string Usuario::obtenerTelefono(){
  67. return Telefono;
  68. }
  69. string Usuario::obtenerFechaNacimiento(){
  70. return FechaNacimiento;
  71. }
  72. int Usuario::obtenerEdad(){
  73. return Edad;
  74. }
  75.  
  76. void Usuario::imprimir(){
  77.  
  78. cout<<"Nombre: "<<Nombre<<endl;
  79. cout<<"Dirección: "<<Direccion<<endl;
  80. cout<<"Telefono: "<<Telefono<<endl;
  81. cout<<"Edad: "<<Edad<<endl;
  82. cout<<"Fecha de Nacimiento: "<<FechaNacimiento<<endl;
  83. cout<<"---------------------------------------"<<endl;
  84. }
  85. Usuario Lee1(){
  86.  
  87. string _Nombre, _Direccion, _Telefono, _FechaNacimiento;
  88. int _Edad;
  89.  
  90.  
  91. cout<<"Ingrese su Nombre: ";
  92. cin>>_Nombre;
  93. cout<<"Ingrese su Edad: ";
  94. cin>>_Edad;
  95. cout<<"Ingrese su Dirección: ";
  96. cin>>_Direccion;
  97. cout<<"Ingrese su Fecha de Nacimiento: ";
  98. cin>>_FechaNacimiento;
  99. cout<<"Ingrese su Telefono: ";
  100. cin>>_Telefono;
  101. cout<<"_______________________________________"<<endl;
  102.  
  103. Usuario Datos1( _Nombre, _Direccion, _Telefono, _FechaNacimiento, _Edad);
  104. return Datos1;
  105. }
  106. int main()
  107. {
  108. setlocale(LC_ALL, "");
  109. string contra, PC, UC;
  110. char res;
  111. int longitudC, opc,opc2;
  112. do
  113. {
  114. system("cls");
  115. cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
  116. cout<<"| Bienvenido al Sistema Bibliotecario |"<<endl;
  117. cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
  118. cout<<"\n~~~~~~ Introduzca su contraseña de acceso ~~~~~~"<<endl;
  119. cin>>contra;
  120. longitudC=contra.size();
  121. PC=contra.substr(0, 1);
  122. UC=contra.substr(longitudC-1,1);
  123.  
  124. try
  125. {
  126. if(longitudC<6)
  127. throw 0;
  128. cout<<"Contaseña correcta"<<endl;
  129.  
  130.  
  131. cout<<"-------------------------------------------"<<endl;
  132. cout<<"-----------Servicios Disponibles-----------"<<endl;
  133. cout<<" 1.-Registro. "<<endl;
  134. cout<<" 2.-Prestamos. "<<endl;
  135. cout<<" 3.-Recargos. "<<endl;
  136. cout<<"-------------------------------------------"<<endl;
  137. cout<<"Seleccione una opción porfavor: ";
  138. cin>>opc;
  139.  
  140. system("cls");
  141. switch(opc)
  142. {
  143. case 1:
  144. {
  145. cout<<"--------Ha ingresado al servicio de Registro--------"<<endl;
  146. Usuario Sujeto;
  147. Sujeto=Lee1();
  148. cout<<"-----------Usuario Registrado en la Base de Datos------------"<<endl<<endl;
  149. Sujeto.imprimir();
  150. break;
  151. }
  152. case 2:
  153. {
  154. cout<<"--------Ha ingresado al servicio de Prestamos--------"<<endl;
  155. cout<<"\nQue accion desea hacer?"<<endl;
  156. cout<<"1.- Registrar Libro"<<endl;
  157. cout<<"2.- Consultar Prestamo"<<endl;
  158. cin>>opc2;
  159. if(opc2==1){
  160. Libro Librito;
  161. Librito.Lee();
  162. cout<<"-----------Libro Registrado------------"<<endl<<endl;
  163. Librito.imprimir();
  164. }
  165.  
  166. if(opc2==2){
  167. Libro Librito;
  168. Librito.Lee();
  169. Librito.imprimir();
  170. break;
  171. }
  172.  
  173. }
  174. case 3:
  175. {
  176. cout<<"--------Ha ingresado al servicio de Recargos--------"<<endl;
  177. Recargos R1;
  178. R1.LeeDatos();
  179. cout<<"Usted tiene un recargo de: $ "<<R1.calcularecargos()<<endl;
  180. break;
  181. }
  182. }
  183.  
  184. }
  185.  
  186. catch (int error)
  187. {
  188. cout<<"------------------------------------------------------"<<endl;
  189. cout<<"Lo sentimos se ha dectectado un error."<<endl;
  190. if(error==0){
  191.  
  192. cout<<"La contraseña debe de tener por lo menos 6 caracteres"<<endl;
  193. cout<<"Intentelo de nuevo. "<<endl;
  194. cout<<"------------------------------------------------------"<<endl;
  195. }
  196. }
  197.  
  198.  
  199. cout<<"Desea hacer otra operacion? S/N: ";
  200. cin>>res;
  201. }while((res=='S'||res=='s'));
  202. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement