Attachment 'Contatto.java'
Download 1 package fondamenti.rubrica;
2
3 public class Contatto
4 {
5
6 private String nome;
7 private String cognome;
8 private String indirizzo;
9 private String email;
10 private String numeroDiTelefono;
11
12 public Contatto(){
13 nome = "";
14 cognome = "";
15 indirizzo = "";
16 email = "";
17 numeroDiTelefono = "";
18 }
19
20 public String getNome() {
21 return nome;
22 }
23
24
25 public void setNome(String n) {
26 nome = n;
27 }
28
29
30 public String getCognome() {
31 return cognome;
32 }
33
34
35 public void setCognome(String c) {
36 cognome = c;
37 }
38
39
40 public String getIndirizzo() {
41 return indirizzo;
42 }
43
44
45 public void setIndirizzo(String i) {
46 indirizzo = i;
47 }
48
49
50 public String getEmail() {
51 return email;
52 }
53
54
55 public void setEmail(String e) {
56 email = e;
57 }
58
59
60 public String getNumeroDiTelefono() {
61 return numeroDiTelefono;
62 }
63
64
65 public void setNumeroDiTelefono(String n) {
66 numeroDiTelefono = n;
67 }
68
69 public void stampa()
70 {
71 System.out.println("nome: "+nome);
72 System.out.println("cognome: "+cognome);
73 System.out.println("indirizzo: "+indirizzo);
74 System.out.println("email: "+email);
75 System.out.println("numero di telefono: "+numeroDiTelefono);
76 }
77
78 public static void main(String[] args) {
79
80 Contatto c = new Contatto();
81
82 c.setNome("Ciccio");
83 c.setCognome("Pasticcio");
84 c.setNumeroDiTelefono("+39098412345");
85
86 c.stampa();
87 System.out.println("");
88
89 Contatto c2 = new Contatto();
90
91 c2.setNome("Pinco");
92 c2.setCognome("Pallino");
93 c2.setNumeroDiTelefono("+390984098765");
94
95 c2.stampa();
96
97 }
98
99
100 }
Attached Files
You are not allowed to attach a file to this page.