Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package oop2016.contest1.gruppo23;
  7.  
  8. import java.util.Objects;
  9.  
  10. /**
  11.  *
  12.  * @author Francesco Avallone
  13.  */
  14. public abstract class Aereomobile
  15. {
  16.     private final String codice;
  17.     private final int numeroSequenziale;
  18.     private static int allocati;
  19.    
  20.    
  21.     public Aereomobile(String codice)
  22.     {
  23.         this.codice=codice;
  24.         numeroSequenziale=hashCode();
  25.     }
  26.  
  27.     @Override
  28.     public int hashCode() {
  29.         int hash = 3;
  30.         hash = 17 * hash + Objects.hashCode(this.codice);
  31.         return hash;
  32.     }
  33.  
  34.    
  35.     public String getCodice() {
  36.         return codice;
  37.     }
  38.  
  39.     public int getNumeroSequenziale() {
  40.         return numeroSequenziale;
  41.     }
  42.  
  43.     public static int getAllocati() {
  44.         return allocati;
  45.     }
  46.  
  47.     @Override
  48.     public String toString() {
  49.         return "Aereomobile n."+
  50.                 numeroSequenziale+" - "+
  51.                 "Codice = "+codice;//To change body of generated methods, choose Tools | Templates.
  52.     }
  53.    
  54.    
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement