Advertisement
julibar

Aporte 2 - Clase Pelicula - Punto 2 del TP

May 7th, 2025
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. //archivo Pelicula.java
  2.  
  3. package Paquete;
  4.  
  5. public class Pelicula {
  6.        
  7.     private static int proxId = 0;
  8.     private final int id;
  9.     private String nombre;
  10.     private Categoria genero;
  11.    
  12.    
  13.     public Pelicula() {
  14.         super();
  15.         proxId = proxId + 1;
  16.         id = proxId;
  17.         nombre = "Sin definir";
  18.         Categoria gen = new Categoria("Sin definir");
  19.         genero = gen;
  20.        
  21.     }
  22.    
  23.    
  24.     public Pelicula(String nombre, String genero) {
  25.         super();
  26.         proxId = proxId + 1;
  27.         id = proxId;
  28.         this.nombre = nombre;
  29.         Categoria gen = new Categoria(genero);
  30.         this.genero = gen;
  31.     }
  32.  
  33.  
  34.     public String getNombre() {
  35.         return nombre;
  36.     }
  37.  
  38.  
  39.     public void setNombre(String nombre) {
  40.         this.nombre = nombre;
  41.     }
  42.  
  43.  
  44.     public int getId() {
  45.         return id;
  46.     }
  47.  
  48.    
  49.     public static int getProxId() {
  50.         return (proxId + 1);
  51.     }
  52.  
  53.    
  54.     public String toString() {
  55.         return nombre + " (" + genero.toString() + ")";
  56.     }
  57.                
  58. }
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement