SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package progetto2;
  2. public class studente {
  3.  private String   nome, cognome;
  4.  private int età;
  5.  private String matricola;
  6.  private int voti []= new int [5];
  7.  //metodo di costruzione
  8.  
  9.  public studente (String N, String C, int E, String M)   {  
  10. this.nome  = N;
  11. this.cognome = C;
  12. this.età = E;
  13. this.matricola = M;
  14.  int voti[] = {0,0,0,0,0,};
  15.  }
  16.  public String getNome () {
  17.  return nome;
  18. }
  19.  public String getCognome () {
  20.  return cognome;
  21. }
  22. public String getMatricola () {
  23.  return matricola;
  24. }
  25. public int getEtà() {
  26.     return età;
  27. }
  28. public void StampaStudente ()  {
  29.  System.out.println ("Nome dello studente:"+getNome()+"Cognome dello studente:"+getCognome()+"Età dello studente:"+getEtà()+"Matricola dello studente:"+getMatricola());
  30.  
  31. }
  32.  
  33. }
  34.  
  35. package progetto2;
  36. public class Progetto2 {
  37.  
  38.  public static void main(String[] args) {
  39.  studente   S1,S2,S3,S4;
  40.  S1 = new studente ("Marco", "Marino", 17, "112qwar2");
  41.  S2 = new studente ("Marco", "Rossi", 17, "113qwar3");
  42.  S3 = new studente ("Marco", "Sossi", 17, "113quartus3");
  43.  S1.StampaStudente();
  44.  S2.StampaStudente();
  45.  S3.StampaStudente();
  46.  }
  47.    
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top