Advertisement
Guest User

Personal

a guest
Dec 11th, 2019
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.42 KB | None | 0 0
  1.  
  2. package Programa;
  3.  
  4.  
  5. public class Personal {
  6.    
  7.     private String nombre;
  8.     private int tituloAcademico;
  9.     private int edad;
  10.     private int puntos;
  11.    
  12.     public Personal(String nombre, int edad, int tituloAcademico){
  13.         this.nombre = nombre;
  14.         this.edad = edad;
  15.         this.tituloAcademico = tituloAcademico;
  16.         if(edad >= 18 || edad <= 30){
  17.             this.puntos = 20;
  18.         }else if(edad > 30){
  19.             this.puntos = 10;
  20.         }
  21.         if(tituloAcademico == 1){
  22.             this.puntos += 10;
  23.         }else if(tituloAcademico == 2){
  24.             this.puntos += 5;
  25.         }
  26.     }
  27.  
  28.     public int getEdad() {
  29.         return edad;
  30.     }
  31.  
  32.     public void setEdad(int edad) {
  33.         this.edad = edad;
  34.     }
  35.  
  36.     public int getPuntos() {
  37.         return puntos;
  38.     }
  39.  
  40.     public void setPuntos(int puntos) {
  41.         this.puntos = puntos;
  42.     }  
  43.    
  44.     public String getNombre() {
  45.         return nombre;
  46.     }
  47.  
  48.     public void setNombre(String nombre) {
  49.         this.nombre = nombre;
  50.     }
  51.  
  52.     public int getTituloAcademico() {
  53.         return tituloAcademico;
  54.     }
  55.  
  56.     public void setTituloAcademico(int tituloAcademico) {
  57.         this.tituloAcademico = tituloAcademico;
  58.     }
  59.  
  60.     @Override
  61.     public String toString() {
  62.         return "Nombre: " + nombre + "\nTítulo Académico: " + tituloAcademico + "\nEdad:" + edad+"\n";
  63.     }
  64.          
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement