GatoBooster

Gym

Apr 2nd, 2016
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.58 KB | None | 0 0
  1. /**
  2.  * Write a description of class Gym here.
  3.  *
  4.  * @author (your name)
  5.  * @version (a version number or a date)
  6.  */
  7.  
  8. //Esta es la declaración de las Variables
  9.  
  10. public class Gym
  11. {
  12.     private String rut; //
  13.     private String nombre; //
  14.     private String apellido; //
  15.     private int edad; //int es para un valor  entero
  16.     private int valor;
  17.     private char sexo; //char es para un character
  18.     private double mensualidad; //double es para un valor no entero
  19.     private boolean vigente; //Los pagos al día "true o false"
  20.     private double hrssemanales; //double es para un valor no entero
  21.    
  22. //Este es el Default    
  23.  
  24. public Gym()
  25. {
  26. this.rut = "17.669.996-k";
  27. this.nombre = "Pirinolli";
  28. this.apellido = "Castillo";
  29. this.edad = 97;
  30. this.sexo ='M';
  31. this.mensualidad = 18000;
  32. this.vigente = true;
  33. this.hrssemanales = 10;
  34.  
  35.  
  36. }
  37.    
  38.    
  39. //Este es el Constructor sin parametros
  40.  
  41. public Gym(String rut,String nombre,String apellido,int edad,char sexo,double mensualidad,boolean vigente,double hrssemanales)
  42. {
  43.  
  44. this.rut = rut;
  45. this.nombre = nombre;
  46. this.apellido = apellido;
  47. this.edad = edad;
  48. this.sexo = sexo;
  49. this.mensualidad = mensualidad;
  50. this.vigente = vigente;
  51. this.hrssemanales = hrssemanales;
  52.  
  53. }
  54.  
  55. //Es el Mutador
  56.  
  57. public void setmensualidad(double mensualidad)
  58.  
  59. {
  60. this.mensualidad = mensualidad;
  61. }
  62.  
  63.  
  64. //Accesadores
  65.  
  66. public String getrut()
  67. {
  68. return this.rut;
  69. }
  70.  
  71. public String getnombre()
  72. {
  73. return this.nombre;
  74. }
  75.  
  76. public String getapellido()
  77. {
  78. return this.apellido;
  79. }
  80.  
  81. public int getedad()
  82. {
  83. return this.edad;
  84. }
  85.  
  86. public char getsexo()
  87. {
  88. return this.sexo;
  89. }
  90.  
  91. public double getmensualidad()
  92. {
  93. return this.mensualidad;
  94. }
  95.  
  96. public boolean getvigente()
  97. {
  98. return this.vigente;
  99. }
  100.  
  101. public double gethrssemanales()
  102. {
  103. return this.hrssemanales;
  104. }
  105.  
  106.  
  107. //Esto es para imprimir los valores
  108.  
  109. public void impresionGym()
  110. {
  111. System.out.println("--------------------------------");
  112. System.out.println("Cliente: " + this.nombre + this.apellido);
  113. System.out.println("--------------------------------");
  114. System.out.println("Mensualidad: $" + this.mensualidad);
  115. System.out.println("Horas semanales: " + this.hrssemanales);
  116. }
  117.  
  118. //Rebajar mensualidad
  119. //Se asume que el porcentaje viene en decimal, ej: 0.1 (es el 10%)
  120. //void no retorna nada
  121. //(int) es para el casting, en otras palabras para obligar a una variable a ser un tipo de dato especifico
  122. public void mensualidad(double porcentaje)
  123. {
  124. valor = (int)(valor - valor * porcentaje);
  125. }
  126.  
  127. //Horas Disponibles
  128.  
  129.  
  130. //Incrementar el valor de la mensualidad en un valor x
  131.  
  132.  
  133.  
  134. }
Advertisement
Add Comment
Please, Sign In to add comment