Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. public class Cliente {
  2.  
  3. private long CI;
  4. private String Nombre;
  5. private String Direccion;
  6. private long Telefono;
  7. private Mascota Mascota;
  8.  
  9. public Cliente(){
  10. CI=0;
  11. Nombre="Sin Nombre";
  12. Direccion="Sin Definir";
  13. Telefono=0;
  14. Mascota masc=new Mascota();
  15. Mascota=masc;
  16. }
  17.  
  18. public Cliente(long ci, String nombre, String direccion, long telefono, Mascota mascota){
  19. CI=ci;
  20. Nombre=nombre;
  21. Direccion=direccion;
  22. Telefono=telefono;
  23. Mascota=mascota;
  24. }
  25.  
  26. public Cliente(Cliente A){
  27. CI=A.getCI();
  28. Nombre=A.getNombre();
  29. Direccion=A.getDireccion();
  30. Telefono=A.getTelefono();
  31. Mascota=A.getMascota();
  32. }
  33.  
  34. public long getCI(){
  35. return CI;
  36. }
  37. public String getNombre(){
  38. return Nombre;
  39. }
  40. public String getDireccion(){
  41. return Direccion;
  42. }
  43. public long getTelefono(){
  44. return Telefono;
  45. }
  46. public Mascota getMascota(){
  47. return Mascota;
  48. }
  49.  
  50. public void setCI(long ci){
  51. CI=ci;
  52. }
  53. public void setNombre(String nombre){
  54. Nombre=nombre;
  55. }
  56. public void setDireccion(String direccion){
  57. Direccion=direccion;
  58. }
  59. public void setTelefono(long telefono){
  60. Telefono=telefono;
  61. }
  62. public void setMascota(Mascota mascota){
  63. Mascota=mascota;
  64. }
  65.  
  66. }
  67.  
  68. public class Mascota {
  69.  
  70. private long Id;
  71. private String Animal;
  72. private String Nombre;
  73. private String Raza;
  74.  
  75. public Mascota(){
  76. Id=0;
  77. Animal="Sin Definir";
  78. Nombre="Sin Definir";
  79. Raza="Sin Definir";
  80. }
  81.  
  82. public Mascota(long id, String animal, String nombre, String raza){
  83. Id=id;
  84. Animal=animal;
  85. Nombre=nombre;
  86. Raza=raza;
  87. }
  88.  
  89. public Mascota(Mascota A){
  90. Id=A.getId();
  91. Animal=A.getAnimal();
  92. Nombre=A.getNombre();
  93. Raza=A.getRaza();
  94. }
  95.  
  96. public long getId(){
  97. return Id;
  98. }
  99. public String getAnimal(){
  100. return Animal;
  101. }
  102. public String getNombre(){
  103. return Nombre;
  104. }
  105. public String getRaza(){
  106. return Raza;
  107. }
  108.  
  109. public void setId(long id){
  110. Id=id;
  111. }
  112. public void setAnimal(String animal){
  113. Animal=animal;
  114. }
  115. public void setNombre(String nombre){
  116. Nombre=nombre;
  117. }
  118. public void setRaza(String raza){
  119. Raza=raza;
  120. }
  121. }
  122.  
  123. import java.util.Scanner;
  124.  
  125. public class main {
  126.  
  127.  
  128. public static void main(String[] args) {
  129. Scanner sc=new Scanner(System.in);
  130.  
  131. Mascota a=new Mascota();
  132. Mascota b=new Mascota();
  133. Cliente A=new Cliente();
  134. A.setMascota(a);
  135. Cliente B=new Cliente();
  136. B.setMascota(b);
  137.  
  138. IngresoMascota(sc, a);
  139. IngresoMascota(sc, b);
  140. IngresoCliente(sc, A, a, b);
  141. IngresoCliente(sc, B, a ,b);
  142.  
  143.  
  144.  
  145. }
  146. static void menù(Scanner sc){
  147. int opcion;
  148. System.out.println("MENU\n1-Ingresar Mascota\n2-Ingresar Cliente\n3-Asignar Mascota\n");
  149. opcion=sc.nextInt();
  150. if(opcion==1){
  151.  
  152. }else if(opcion==2){
  153.  
  154. }else if(opcion==3){
  155. AsignarMascota(sc);
  156. }
  157. }
  158. static void IngresoCliente(Scanner sc, Cliente X, Mascota a, Mascota b){
  159.  
  160. System.out.println("INGRESO DE NUEVO CLIENTE\n");
  161. System.out.println("Ingrese Nombre del Cliente:");
  162. X.setNombre(sc.next());
  163. System.out.println("Ingrese CI del Cliente:");
  164. X.setCI(sc.nextLong());
  165. System.out.println("Ingrese Direccion del Cliente:");
  166. X.setDireccion(sc.next());
  167. System.out.println("Ingrese Telefono del Cliente:");
  168. X.setTelefono(sc.nextLong());
  169. int opcion;
  170. do{
  171. System.out.println("¿Que mascota tiene el cleinte?\n1-"+a.getNombre()+"\n2-"+b.getNombre());
  172. opcion=sc.nextInt();
  173. if(opcion==1){
  174. X.setMascota(a);
  175. }else if(opcion==2){
  176. X.setMascota(b);
  177. }
  178. }while(opcion<1||opcion>2);
  179. }
  180.  
  181. static void IngresoMascota(Scanner sc, Mascota x){
  182.  
  183. System.out.println("INGRESO DE NUEVA MASCOTA\n");
  184. System.out.println("Ingrese Nombre de la Mascota:");
  185. x.setNombre(sc.next());
  186. System.out.println("Ingrese Id de la Mascota:");
  187. x.setId(sc.nextLong());
  188. System.out.println("Ingrese la especie de la Mascota:");
  189. x.setAnimal(sc.next());
  190. System.out.println("Ingrese la raza de la Mascota:");
  191. x.setRaza(sc.next());
  192. }
  193.  
  194. static void AsignarMascota(Scanner sc){
  195.  
  196. }
  197. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement