Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1. // CLASSE PRICIPALE
  2. public class Dipendente {
  3.     private String nome;
  4.     private String cognome;
  5.     private String matricola;
  6.     private int anno;
  7.     public Dipendente(String n,String c,String m,int a) {
  8.         nome=n;
  9.         cognome=c;
  10.         matricola=m;
  11.         anno=a;
  12.     }
  13.     public String GetNome() {
  14.         return nome;
  15.     }
  16.     public String GetCognome() {
  17.         return cognome;
  18.     }
  19.     public String GetMatricola() {
  20.         return matricola;
  21.     }
  22.     public int GetAnno() {
  23.         return anno;
  24.     }
  25.     public void ChiSei() {
  26.         System.out.println("_ Nome:"+GetNome()+"Cognome:"+GetCognome()+"Matricola:"+ GetMatricola()+"Anno:"+GetAnno());
  27.     }
  28. }
  29.  
  30. // SOTTOCLASSE
  31.  
  32. public class Studente extends Dipendente {
  33.  
  34.     public Studente(String n, String c, String m, int a) {
  35.         super(n, c, m, a);
  36.         // TODO Auto-generated constructor stub
  37.     }
  38.     private String sezione;
  39.     private String classe;
  40.     private int voto_fin;
  41.     public Studente(String s, String cl, int v) {
  42.         sezione =s;
  43.         classe=cl;
  44.         voto_fin=v;
  45.        
  46.     }
  47.     public String GetSezione() {
  48.         return sezione;
  49.     }
  50.     public String GetClasse() {
  51.         return classe;
  52.     }
  53.     public int GetVoto() {
  54.         return voto_fin;
  55.     }
  56.     public void ChiSei_Studente() {
  57.     System.out.print("Sezione:"+GetSezione()+"Classe:"+GetClasse()+"Voto:"+GetVoto());
  58.     super.ChiSei();
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement